Hello. I was wondering if I could get some help with this. I have a site that is created with smarty PHP. I want to add a really small article to the site but I only want it to show up on one certain page that is not the index page. In the control panel of the script there is an area that I enter the html code for my ads and I can add the ad there in html. Is there a code I could use, thats html, that would only display the ad on a particular page? what i have: Looking for a new game to play? Try<a href="randomsitedotcom">site</a> Code (markup): I want it to show up on this page only "/profile/lisshrtt4.html" so is there a HTML code that would make this only show up on this page?
Yea all you have to do is open the html page with a editor and then add the code in where you want it to go.
I cant do that cause it built with a smarty template script there is a layout.tpl file that includes everything then I create a new file "test.tpl" and add the ad there then attch it to the layout.tpl page but it shows on every page
Ya, I still cant get it, but I dont think there is an HTML code that would tell the site to only display the ad if its a certain page.
I have tried many {if} codes that people have told me in this forum and in smarty forums and they dontseem to work. What I need is something like {if "/profile/lisshrtt4.html"} include_file "lp31.tpl"{/if} or something like that. I have no clue when it comes to php and smarty.
You'll need to set the smarty variable in the php code and then just use it in the layout file. E.g $somevariable = false; if (correct page) { $somevariable = true; } smarty->assign('isSomePage' = $somevariable); Code (markup): Then in the .tpl file.. {if $isSomePage} show something.. {/if} Code (markup):
How would the code be if the destination page for the ad was /profile/lisshrtt4.html Code (markup): and the file to be inserted was lp31.tpl Code (markup):
well, for correct page, you'd have to get the URI of the page first and then use explode() and strpos() to get rid of the stuff you don't want I don't have time to do it all for you, but to get the URI you use this: $uri = $_SERVER['REQUEST_URI']; Code (markup): Then go to php.com and check those two functions I just told you about - explode() and strpos() to get rid of the stuff you don't need. After that, just use a smarty include statement where I put "show something" before