Code: Select all
{if $page_alias == 'home'}
Code: Select all
echo trim($_SERVER['REQUEST_URI']);
Code: Select all
{if {current_url} == '/index.php'}
Code: Select all
{if $page_alias == 'home'}
Code: Select all
echo trim($_SERVER['REQUEST_URI']);
Code: Select all
{if {current_url} == '/index.php'}
The first code snippet just tests for the page alias, not the URL or any GET variables.tralli wrote: I need to get the url and test if it is '/index.php' or '/index.php?var=something' I tried doing something like this:but it returns true regardless of the parameters I want it to return true only if the url is /index.php. So I figured I could make a tag called current_url with this codeCode: Select all
{if $page_alias == 'home'}
it returns the string I want but how do I test it in my template? I can't writeCode: Select all
echo trim($_SERVER['REQUEST_URI']);
Code: Select all
{if {current_url} == '/index.php'}
{capture assign='url'}{current_url}{/capture}
{if $url == '/index.php'}
do this
{/if}
Code: Select all
{$smarty.server.REQUEST_URI}