Variables for a User Defined Tag

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
goldleader
New Member
New Member
Posts: 8
Joined: Mon Sep 28, 2009 8:22 am

Variables for a User Defined Tag

Post 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.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Variables for a User Defined Tag

Post 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>';
User avatar
goldleader
New Member
New Member
Posts: 8
Joined: Mon Sep 28, 2009 8:22 am

Re: Variables for a User Defined Tag

Post 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.
Post Reply

Return to “Developers Discussion”