103 Posts
Osep45
7 years ago
Topic

Hi,
I have a dynamic select field that can contain one or more values, separated by coma, from #__content
For example : 233,154,854

Each value (id) corresponds to a content title (text).
I want to display this field, in a list view, like that :
<li><a href="/.../233-alias">Title of content 233</a></li>
<li><a href="/.../154-alias">Title of content 154</a></li>
<li><a href="/.../854-alias">Title of content 854</a></li>

How can I render a such list ?

Osep45

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
0
Level 1

Easiest would be to use beforeRender plugin or temlate override, but you need to know some php to do this.

103 Posts
Osep45
7 years ago
0
Level 1

Thanks ! 

I have manage a php code in a template variation : il works.

 // getValue display "233,154,854"
$suggestion_chants = $cck->getValue('suggestion_chants');

// renderField display "Titre 233, Titre 154, Titre 854" in one value
$suggestion_chants_render = $cck->renderField('suggestion_chants'); 

// explode the ids and Titres
$id = explode(",", $suggestion_chants); 
$titre = explode(",", $suggestion_chants_render); 

for ($i=0; $i<10; $i++) {
     if ($id[$i] != '') {
         echo "<li><a href='".$id[$i]."'";  // ... and display the link without alias - never mind
         echo " target='blank'>".$titre[$i]."</a></li>"; // ... and display the title
     } else {
         break;
     }
 }

But I discover this plugin just after :

http://www.pulsar-informatique.com/telechargements-gratuits/plugin-de-typo-pour-listes-seblod

I think it should do what I was searching.

Get a VIP membership