简体   繁体   中英

How do I echo custom article parameters in Joomla

I'm trying to create a simple text field that can be optionally shown on a Joomla article.
At the moment I have created 2x custom article params (viewable and quick_summary)

administrator > components > com_content > models > article.xml

<params group="advanced">
<param name="viewable" type="list" default="no" label="Viewable" description="">
<option value="no">No</option>
<option value="yes">yes</option>
</param>
<param name="quick_summary" type="textarea" rows="10" cols="30" 
    label="Summary" description="Summary" />
<param type="spacer" />
...
</params>

In the template file
To have the quick_summary show depending on the status of viewable I have used the following:

<?php 
if ($this->params->get('viewable') == "yes") {
echo $this->params->get('quick_summary');
}
?>

Any help hugely appreciated

USe

$htmlArray = $this->params->renderToArray('nameSpace','groupName');

This will return html of all parameters of groupName, as array. Then echo them using for loop or using index.

echo $this->params->render('nameSpace','groupName');

This will echo the html of all parameters of GroupName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM