Can be added if necessary in the administrative part of any of the modules, additional field and display the value in the public part.
As an example, add a field "Author" in the news module.
For this table {news} using, for example, phpMyAdmin, add field author with the type varchar(250).
Run the following SQL-query:
Example:
ALTER TABLE `YOUR_PREFIX_news` ADD `author` VARCHAR(250) NOT NULL;
Next, add to the array $variables in the file modules/news/admin/news.admin.php following entry:
Example:
'main' => array (
'author' => array(
'type' => 'text',
'name' => 'Аuthor'
),
…
Here:
All! That's enough to the "author" appeared in the administrative part of the site on the edit page of the news. Naturally, it is possible to fill, save, edit.
Next you need to bring this field anywhere in the user part of the site, for example, on the news page of the list. The case, when the module settings are not connected category.
Make changes to the file modules/news/news.model.php. The adjustment will affect the method list_query, where all fields is fetched news.
Example:
$rows = DB::query_range_fetch_all("SELECT e.id, e.author, e.created, ...");
Now, add in the news cycle of the output file modules/news/views/news.view.list.php code:
Example:
if(! empty($row["author"]))
{
echo $row["author"];
}
All! At the news will appear in the list of our field "Author".
If the categories are connected, you need to edit method list_category_elements_query in the file modules/news/news.model.php:
Example:
$rows = DB::query_range_fetch_all("SELECT e.id, e.author, e.[name], ...");
Next, you need to act similarly to the example of the disabled categories. File modules/news/views/news.view.list.php:
Example:
if(! empty($row["author"]))
{
echo $row["author"];
}
To display the author's detailed description of the news you need to make changes to the method id_query of the same file modules/news/news.model.php:
Example:
$row = DB::query_fetch_array("SELECT id, author, [name], [anons], ...");
Output Template detailed description of the news is in the file modules/news/views/news.view.id.php. The author's name is stored in $result['author']
. To display it in the right place to add code file:
Example:
if(! empty($result['author']))
{
echo $result['author'];
}
You may need to display the author's name in the latest news block. Open the file modules/news/news.model.php and method show_block() the following changes:
Example:
$result["rows"] = DB::query_range_fetch_all("SELECT e.id, e.author, ...");
Next, in the file modules/news/views/news.view.show_block.php in the cycle of news output will add:
Example:
if(! empty($row["author"]))
{
echo $row["author"];
}
Adding fields in other modules the same way.