10 years ago
Topic

Hello everyone,

I use the Related article to link trainers to formations using Field X and I have problems to display it.

When I do:

<?php foreach($cck->get('formation')->value as $formation){ ?>
          <li><a href="/<?php echo $formation->link; ?>"><?php echo $formation->value; ?></a></li>
<?php } ?>

the anchor is the id of my formation article, how can I get the title ?

Another question, is there a way the url look like : category/article
because I would like to only one url by article

Get a Book for SEBLOD
10 years ago
1
Level 1

Hi Sciuridae,

Can you tell us what you see when you set the following code

var_dump( $cck->get('formation');

Regards,
Mehdi

10 years ago
0
Level 2

thank you Medhi for your answer,

I can see my mistake, instead of:

<a href="/<?php echo $formation->link; ?>"><?php echo $formation->value; ?></a>

I just have to use:

<?php echo $formation->text; ?> 
or 
<?php echo $formation->html; ?>

the link is already in the variable, that mean than I can't customise it here...
I'm going to try what I saw in another topic, about using List & type to only have one url by page, it seems to be the only way.

Get a Book for SEBLOD