Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Display certain content when page is detected

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
charly123
Smarty n00b


Joined: 26 Apr 2016
Posts: 1

PostPosted: Tue Apr 26, 2016 8:52 pm    Post subject: Display certain content when page is detected Reply with quote

How do I get certain content to display on a certain page? So if a certain page is reached I want to display certain content.

I've been trying this:

<?php
$smarty->assign('is_news',$_SERVER['SCRIPT_NAME']=='url');

{if $is_news}
...content...
{/if}

?>


It's not working for me and I don't know why (I'm new to php).

Thanks!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Apr 27, 2016 1:08 pm    Post subject: Reply with quote

You're asking an impossible question.
When your page is requested, you already know what page it is. And you can display the necessary template for it straight away.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP