简体   繁体   中英

how to get attribs in tags Joomla

For extra data fields used in Joomla:

<?php
    $attribs = new JRegistry($this->item->attribs);
    echo $attribs->get('extrafield_name');
?>

or

<?php echo $params->get('extrafield_name'); ?>

I tried the same thing, to display extra fields of com_content in com_tags . as I can fix that. Thank you for your help.

Situation before this change: I have a couple of custom fields added to my article using the same technique as described here: https://zunostudios.com/blog/development/203-how-to-add-custom-fields-to-articles-in-joomla I then made a menu item of the type "tagged items" and tried to override the joomla default template for the tagged items list, which I found under components/com_tags/views/tag/tmpl/default_items.php However the attribs are not available in $item (line 35 and ongoing)

Situation after this change: The query which returns the items of the "tagged items" now also returns the attribs. And one can use something like this to use the attribs in the tagged items list: $attrb = json_decode($item->attribs); echo $attrb->foo;

I hope I didn't break anything - this is my first patch to the joomla project, so I'm happy to hear your feedback and improve my solution.

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