Page 1 of 1

User defined Tags -- Conditions are not checked -- give the solution

Posted: Tue Sep 09, 2008 7:25 am
by kumaran
Greetings Friends,

I get the values from user defined tags(UTD). But I unable to check the if condition. Please look the following my code.

Please give the solution...

Page name is test

activelink----- UDT
===============

$pageurl=count(explode('/',$_REQUEST["page"]));
if($pageurl==1)
{
echo $pagename=$_REQUEST["page"];
}
else
{
echo $pagename=end(explode('/',$_REQUEST["page"]));
}


Global Content blocks
-----------------------------
{if activepagelinktest eq 'test'} welcome {/if}

Please give the solution for me...

Regards

Kumaran

Re: User defined Tags -- Conditions are not checked -- give the solution

Posted: Tue Sep 09, 2008 7:42 am
by alby
kumaran wrote: I get the values from user defined tags(UTD). But I unable to check the if condition. Please look the following my code.
You display the value (echo) then you don't have any value.
And where is your UDT (activelink) call?

Alby

Re: User defined Tags -- Conditions are not checked -- give the solution

Posted: Tue Sep 09, 2008 10:07 am
by kumaran
Hi Alby,

I call the {activelink} in global content pages. But inner i check the condition for example below.

{if activelink eq 'test'} get the blank of the result is empty. How I check the condition...

Please guide me, very urgent...

Thanks & Regards

Kumaran

Re: User defined Tags -- Conditions are not checked -- give the solution

Posted: Tue Sep 09, 2008 7:00 pm
by NaN
The active link should be the page alias of the currently displayed page, shouldn't it?
Use {get_template_vars} to see what template vars contains what data.
You don't need an UDT to get the active link.

Re: User defined Tags -- Conditions are not checked -- give the solution

Posted: Tue Sep 09, 2008 7:10 pm
by alby
NaN wrote: The active link should be the page alias of the currently displayed page, shouldn't it?
yes, if it's then:

Code: Select all

{if $page_alias eq 'test'} welcome {/if}
or indeed (not tested):

Code: Select all

global $gCms;

$pageurl=count(explode('/',$_REQUEST["page"]));
if($pageurl==1)
{
   $pagename=$_REQUEST["page"];
}
else
{
   $pagename=end(explode('/',$_REQUEST["page"]));
}   

$gCms->smarty->assign('activepagelinktest', $pagename);

and:
{if $activepagelinktest eq 'test'} welcome {/if}


Alby