caplock Posted July 1, 2008 Share Posted July 1, 2008 I want to show an image to all pages accept one specific page. How should I write to achieve this? I try this but did not work: {if $smarty.server.PHP_SELF == 'filename.php'} <img src="images/imagename.gif"> {/if} anyone can show me how to write something like this? 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted July 1, 2008 Share Posted July 1, 2008 Try != instead of == If that doesn't work, $smarty.server.PHP_SELF might be evaluating to something unexpected. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 1, 2008 Share Posted July 1, 2008 Try != instead of == If that doesn't work, $smarty.server.PHP_SELF might be evaluating to something unexpected. "==" means equals. "!=" means does not equal. If the equality operator isn't working in his code, how would the inequality operator make any difference? Maybe one of these will help: http://www.smarty.net/manual/en/language.variables.smarty.php 0 Quote Link to comment Share on other sites More sharing options...
joe123 Posted July 1, 2008 Share Posted July 1, 2008 I don't know if this is what you mean , but with this code you can show the image in all pages except the one with the title you decide try it because i didn't {if $pagetitle == "title of the page that you do not want to show the image"}{else}<img src="images/imagename.gif">{/if} 0 Quote Link to comment Share on other sites More sharing options...
brianoz Posted July 1, 2008 Share Posted July 1, 2008 If the equality operator isn't working in his code, how would the inequality operator make any difference? His test was around the wrong way, did you notice? It would display the image on only the one page rather than the reverse, which is what he wanted; that may have fitted his definition of "not working"!! 0 Quote Link to comment Share on other sites More sharing options...
caplock Posted July 1, 2008 Author Share Posted July 1, 2008 I don't know if this is what you mean , but with this code you can show the image in all pages except the one with the title you decide try it because i didn't {if $pagetitle == "title of the page that you do not want to show the image"}{else}<img src="images/imagename.gif">{/if} The problem is that I have a few pages with the same $pagetitle so that I can display certain banner for these pages. Now what I need is to show an image to a specific page within that $pagetitle. 0 Quote Link to comment Share on other sites More sharing options...
joe123 Posted July 1, 2008 Share Posted July 1, 2008 Try this {if $pagename == "filename.php"}{else}<img src="images/imagename.gif">{/if} i am not sure if it's $pagename or $filename 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted July 2, 2008 Share Posted July 2, 2008 I though smarty used "eq" and "ne" rather than the php == style ? 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 2, 2008 Share Posted July 2, 2008 I believe its both you can use. 0 Quote Link to comment Share on other sites More sharing options...
joe123 Posted July 2, 2008 Share Posted July 2, 2008 http://www.nusphere.com/php/templates_smarty_functions1.htm 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.