Reputation: 4019
I am creating new theme using joomla. I have uploaded the logo in admin and trying to show the uploaded image using $this->params->get('logo')
But it is not working
In my templateDetails.xml I have added
<config>
<fields name="params">
<fieldset name="advanced">
<field name="logo" type="media" label="TPL_SOFT_FIELD_LOGO_LABEL" description="TPL_SOFT_FIELD_LOGO_DESC" />
<field name="banner" type="media" label="TPL_SOFT_FIELD_BANNER_IMAGE_LABEL" description="TPL_SOFT_BANNER_IMAGE_DESC" />
</fieldset>
</fields>
</config>
In index.php I have added two lines
echo $this->params->get('logo');
echo $headerImage = $this->params->get('banner');
These two line returns nothing. Whats wrong with my code.
Update - 1
stdClass Object
(
[id] => 9
[home] => 0
[template] => soft
[params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
[logo] =>
)
)
)
Upvotes: 1
Views: 600
Reputation: 19743
To get parameters from the template, you must firstly include this line at the top of your index.php file:
$params = JFactory::getApplication()->getTemplate(true)->params;
otherwise $this
will not return anything.
Hope this helps
Upvotes: 1