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

URL selected, insert defferent CSS and JS file

 
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
Nitiphone
Smarty n00b


Joined: 21 Oct 2020
Posts: 2

PostPosted: Wed Jan 20, 2021 2:20 pm    Post subject: URL selected, insert defferent CSS and JS file Reply with quote

Dear All,
I am so newbie with smarty and I need your help to guide me about smarty URL selected
as I have www.AAA/index/ and www.AAA/help/
I would like to add special text or something when user access www.AAA/help/
How can I use url selected as below
on a tpl file
{if isset($help_selected)}
Hello Help URL
{else}
Not here
{/if}
Back to top
View user's profile Send private message
bsmither
Smarty Elite


Joined: 20 Dec 2011
Posts: 322
Location: West Coast

PostPosted: Fri Jan 22, 2021 1:21 am    Post subject: Reply with quote

Smarty makes available the $_SERVER array. So, one can test for:
Code:
{if $smarty.server.REQUEST_URI|strpos:'/help/' !== false}Help.
{else}Nope.
{/if}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Jan 22, 2021 7:33 pm    Post subject: Reply with quote

I would NOT perform this in template.

Either pass the text to template as content variable or use a separate template for specific path.

Sorting through request URL is a task for routing part of your PHP code.
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