10 years ago
10
Topic

Hi,

How can i add a custom link to a field and add in this link the userid.

My goal is to put a link on the "created by" field using the Userid, link should be like :

index.php?com_mycom&controller=mycontrol&uid=USERIDFROMSEBLOD

Some idea ?

Get a Book for SEBLOD
693 Posts
rpoy
10 years ago
2
Level 1

Hi Pascal,

You can use an HTML Typography option #2. 

<a href="/?com_mycom=&controller=mycontrol&uid=$cck-&gt;getValue('created_by'=&gt;');=">$cck->getValue('created_by');</a>

This post shows something similar.

Hope that helps,

Randy

10 years ago
1
Level 2

Hi Randy,

Thx for helping.

This don't work.

$cck->getValue('created_by'); return nothing ...

And for id var i need id and this return value ...

10 years ago
0
Level 3

The field created_by needs to be in the content tab in the position that you are overriding. Then you can retrieve it's value.

10 years ago
0
Level 1

Ok so this what i've done and IT DON'T WORK !

In the same position (SIDEBODY-A) i have :

The "Created by" field with a class "hidden" to hide it.

A text field called "Author" with that html code in HTML Typo : 

<a href="/component/ekorner/?controller=auteur&id=$cck-&gt;getValue('created_by');=">$cck->getValue('created_by');</a>

4229 Posts
Kadministrator
10 years ago
0
Level 1
10 years ago
0
Level 1

In HTML Typo you cannot use "$cck->getValue". There you can use *value*. This will place the value of the field that you are applying the typo to.

In your case you need to do what Klas suggested above to build your link.

10 years ago
1
Level 1

Hi Gus and thx for helping,

 I've tried the method given by klas and it is ok to get another field vairable in link but how can i customize the link ??

This method ok only for Seblod standard link (see, del, form, list or joomla menu) ...

Please provide a step by step method as i'm losing hours on this ... demotivating me on this extension !

10 years ago
0
Level 2

To be true i've tried lot of things and nothing works ... :/

10 years ago
0
Level 1

Perhaps i was not enough clear so one more time this what i try to do :

Display author name (field created by).

Add a custom link on it.

Add at end of this custom link the userid of author.

So in HTML it give that result :

<a href="/?my_custom_link?userid=999">The Author name</a>

Where 999 is the userid of author !

Please how to that ???

10 years ago
0
Level 1

Ok, finally it was simple ...

The simple way is to create a Joomla menu link and use it as link for the created by field.

Then use Klass method to add the url var.

So bad i didn't think about it sooner.

Get a VIP membership