Page 1 of 1

Variables for a User Defined Tag

Posted: Thu Aug 19, 2010 2:51 pm
by goldleader
Hello.

I am integrating SMF with cmsms and have managed to get it working. I first have a UDT with..

Code: Select all

require_once('underhive/forum/SSI.php');
$Referrer = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$_SESSION['login_url'] = $Referrer;
I declare this at the very start of my template before anything else.

With that I have been able to declare includes from SMF's SSI via user defined tags. Forexample I put ssi_welcome(); inside a tag called smf_welcome and call {smf_welcome} and it does what I want it to.

What I want to do though is make it so I don't have to make a seperate UDT for each SSI include. For example if I could have a tag called smf_inculde and call each different include by a variable, for example {smf_include var="ssi_welcome"} or {smf_include var="ssi_login"}

There are about twenty SSI includes you see, and I'm thinking of making more.

Does anyone know how I could do this?

Thanks for any help.

Re: Variables for a User Defined Tag

Posted: Thu Aug 19, 2010 3:04 pm
by Jos
The User Handbook has the answer  ;)
http://wiki.cmsmadesimple.org/index.php ... fined_Tags

{myUDT name='world'}

myUTD:

Code: Select all

echo '<h3>Hello ' . $params['name'] . '!</h3>';

Re: Variables for a User Defined Tag

Posted: Thu Aug 19, 2010 3:31 pm
by goldleader
Ah. I had parameters confused with variables. Still learning. Thank you.

I have it now. I made an UDT called smf_include and used...

Code: Select all

$ssiprefix = 'ssi_';
$ssiparam = $params['include'];

$ssiinclude = $ssiprefix . $ssiparam;

$ssiinclude();

SO I can call {smf_include include="welcome"} and it returns the ssi_welcome(); function.

Thank you for your help.