5 years ago
Topic

Hello @all

[ French Use Case ]

Joomla 3.9.3
Seblod 3.x
PHP 7.1

Seblod / 1. Admin : In Form, I use the field "Related Article"
Seblod / 4. Content : I placed the field

Joomla / Article : There is a dropdown, I can choose the article

Joomla / Frontend : just the ID of the article appear

---

So, in my template, I try several ways to the the link.
1: <?php echo $cck->get('my_related_article')->value; ?>
2: <?php echo $cck->get(''my_related_article')->link; ?>
3: <?php echo $cck->getValue(''my_related_article'); ?>

With 1 and 3, I get the ID.
With 2, I get the alias of the current item menu.

---

Of course, in Seblod / 4. Content, option 2 (in square button), I choosed the option "view".
But no link was generated.

I have to do something more ?

Thank you for your help

Get a Book for SEBLOD
4229 Posts
Kadministrator
5 years ago
3
Level 1

do <?php var_dump( $cck->getValue(''my_related_article')); ?>

this will output all available properties, so you can see which one has the needed value. You can later access this property by $cck->getValue(''my_related_article')->PROPERTYNAME (replace PROPERTYNAME with the name of the property)

5 years ago
2
Level 2

Thank you Klas.

I tried <?php var_dump( $cck->getValue(''my_related_article')); ?>
In frontend, it shows string(3) "683" 

So, just the ID of the article :(

How to get the others properties ?

4229 Posts
Kadministrator
5 years ago
1
Level 3

Write just get, not getValue - getValue will get you only value property

5 years ago
0
Level 4

Great! Thank you.

<?php var_dump( $cck->get(''my_related_article')); ?>
It shows me everything!

So, I find the good property :)
<?php echo $cck->get('my_related_article')->text; ?>

And this generates the "intro" view of my article.

Perfect 👌

Get a Book for SEBLOD