Parameters in User Defined Tags?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
finster

Parameters in User Defined Tags?

Post by finster »

Hi all,

Just wondering if there is a way to have parameters within user defined tags. I have had a good look around but can't find any information on creating tags.

I basically want to pass in a string to the tag, and for the tag to then spit out a with the string inside.

e.g.{ image_link("hedgehog") } would go to something like 

I have the PHP ready, I just need to get it into a tag. Or will I have to use a proper tag? Is there any basic info on creating tags/user defined tags?

I have tried testing the basics of this in a user defined tag but it doesn't want to work (smarty errors) : -

name: image_link($fname)
code: echo $fname;


Am I missing something obvious?

Cheers.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Parameters in User Defined Tags?

Post by Ted »

{image_link src='hedgehog'} can be done with:

Code: Select all

echo '<a href="'.$params['src'].'.jpg" target="_blank"><img src="t_'.$params['src'].'.jpg"></a>';
finster

Re: Parameters in User Defined Tags?

Post by finster »

Excellent - thanks very much - thought it could be done - just my syntax. My hedgehog is now being displayed :)

For reference if anybody looks at this again, wishy's code goes in the "code" section of the user defined tag, the "name" doesn't need anything extra - just the name of the tag (in my case "image_link").

Thanks again!
Locked

Return to “CMSMS Core”