I'm using htdig to index my site, but the problem is that it indexes the navigation menu, which confuses it a little bit. While the results are usually still pretty good, there not as good as they could be. So I want CMS to not display the navigation bar if the useragent has 'htdig' in it. would this work?
{if htdig}
{cmsmodule module='CSSMenu'}
{/if}
and then add as a user defined function for 'htdig'
if( instr($_SERVER['HTTP_USER_AGENT'],"htdig")!==false){ return true; }
return false;
using smarty
-
arl
Re: using smarty
I had a similar problem, I wanted to use the current page alias in a smarty if statement in my template. Like you, I tried to use a tag in the if-statement instead of a variable, but that did not seem to work and I cannot find anything about this in the smarty documentation. Perhaps it is just not possible?
What I did instead was to work around it. I use the tag to set a variable with the result and then use this variable in the if statement. You should be able to do something similar.
My tag {thispage}:
My template:
It is not pretty, but it works...
Does anyone know of a more elegant solution?
Allan
What I did instead was to work around it. I use the tag to set a variable with the result and then use this variable in the if statement. You should be able to do something similar.
My tag {thispage}:
Code: Select all
global $gCms;
$smarty->assign('thispage',$gCms->variables['page_name']);
Code: Select all
{thispage}
{if $thispage == "xxxx"}
Some stuff here...
{/if}
Allan
-
alby
Re: using smarty
try:trick wrote: I'm using htdig to index my site, but the problem is that it indexes the navigation menu, which confuses it a little bit. While the results are usually still pretty good, there not as good as they could be. So I want CMS to not display the navigation bar if the useragent has 'htdig' in it. would this work?
{if htdig}
{cmsmodule module='CSSMenu'}
{/if}
and then add as a user defined function for 'htdig'
if( instr($_SERVER['HTTP_USER_AGENT'],"htdig")!==false){ return true; }
return false;
{if $smarty.server.HTTP_USER_AGENT != "htdig"}
....
{/if}
Alby
Last edited by alby on Thu Sep 08, 2005 2:15 pm, edited 1 time in total.
-
trick
Re: using smarty
Thanks, I had tried this before, but I couldn't get it to work consitantly, it was acting incredibly weird. I finnally figured out why, The firefox UA switcher doesn't actually take effect until *after* the next page reload, so I was thinking my user agent was somthing it wasn't.arl wrote: ....
My tag {thispage}:My template:Code: Select all
global $gCms; $smarty->assign('thispage',$gCms->variables['page_name']);It is not pretty, but it works...Code: Select all
{thispage} {if $thispage == "xxxx"} Some stuff here... {/if}Does anyone know of a more elegant solution?
Allan
