It works but it is not great. It's about getting the fields of a subform to display the urls and other fields in a loop

Today I have PHP code:

<?php if (!empty($this->item->jcfields[111]->value)): ?>

    <br /><b><span><i class="fa fa-link fa-1x" aria-hidden="true"></i></span> Pros des films :</b>

        $field_value = json_decode($this->item->jcfields[111]->rawvalue);
        $app = Factory::getApplication();
        $factory = $app->bootComponent('com_content')->getMVCFactory();

    <?php foreach ($field_value as $value): ?>
            $article_id = $value->field110;
            $table = $factory->createTable('Article', 'Table');
            $item_catid = $table->catid;
            echo HTMLHelper::link(
     <?php endforeach ?>

    <?php endif ?>

The rendering is : Pros des films : kamea-meah meteore-films​

Le code HTML est : Code HTML:

<a href="/index.php?option=com_content&amp;view=article&amp; id=119&amp;catid=21&amp;Itemid=159&amp;lang=fr">kamea-meah</a>
<a href="/index.php?option=com_content&amp;view=article&amp; id=122&amp;catid=21&amp;Itemid=159&amp;lang=fr">meteore-films</a>​

1/ how to have a SEF url ? I have set the SEF url in the general config

2/ how to add another subform field and formatting?

Film pros : kamea-meah (production) - meteore-films (direction)


echo '<pre>', print_r($field_value), '</pre>';


stdClass Object
[row0] => stdClass Object
[field110] => 119
[field112] => Array
[0] => film_rea


[row1] => stdClass Object
[field110] => 122


I'll need to retrieve the term "director from the value of "film_rea" custom field

  • Hi I have made good progress but I am missing one last point concerning the router.
    – Hdcms
    May 22, 2023 at 15:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.