开发者

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="1开发者_如何学C0" 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜