Answer the question
In order to leave comments, you need to log in
How to add category name and date to intro_image.php file in Joomla 3?
Hello everyone !
I have a file:
templates/my_template/html/layouts/joomla/content/intro_image.php
templates/my_template/html/layouts/joomla/content/intro_image.php
$this->category->text
$this->category->title
$title = $this->escape($displayData['item']->category_title);
templates/my_template/html/layouts/joomla/content/info_block/category.php
templates/my_template/html/layouts/joomla/content/info_block/publish_date.php
if ($useDefList && ($info == 0 || $info == 2)) :
echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'above'));
endif;
echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'above'));
Answer the question
In order to leave comments, you need to log in
It turned out that you can still do without a query to the database ...
It was enough to
create 2 files:
<?php defined('JPATH_BASE') or die;
echo $this->escape($displayData['item']->category_title);
?>
<?php defined('JPATH_BASE') or die;
echo JHtml::_('date', $displayData['item']->publish_up, JText::_('DATE_FORMAT_LC2'));
?>
$cat_name = JLayoutHelper::render('joomla.content.info_block.category_title', array('item' => $this->item));
$art_publish_date = JLayoutHelper::render('joomla.content.info_block.publish_date_no_html', array('item' => $this->item));
JRequest::setVar('cat_name', $cat_name, 'post'); //задаем глобальную переменную
JRequest::setVar('art_publish_date', $art_publish_date, 'post'); //задаем глобальную переменную
$cat_name = JRequest::getVar('cat_name', '', 'post'); //считываем глобальную переменную
$art_publish_date = JRequest::getVar('art_publish_date', '', 'post'); //считываем глобальную переменную
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question