Jump to content

How do I do this? PHP_SELF


caplock

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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? :P 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"!!
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated