Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

meaning of the smarty code

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
ashok9999
Smarty n00b


Joined: 13 Nov 2017
Posts: 1

PostPosted: Fri Nov 17, 2017 4:35 am    Post subject: meaning of the smarty code Reply with quote

I'm new to smarty and I'm seeing this line

<link rel="shortcut icon" href="
{$system['system_url']}/themes/{$system['theme']}/images/favicon.png" />
This line is used to set favicon but they can use direct the image url "images/favicon.png" so why they used
Back to top
View user's profile Send private message Send e-mail
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1147

PostPosted: Fri Nov 17, 2017 4:39 pm    Post subject: Reply with quote

Without knowing the content of each variable, I could only guess that they used it to prevent ambiguity of relative path reference.
Back to top
View user's profile Send private message
bsmither
Smarty Pro


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

PostPosted: Fri Nov 17, 2017 5:03 pm    Post subject: Reply with quote

The theme publisher is making it so that the template need not be changed for each sub-theme that could exist, and for installations that may exist in a sub-folder.

There should be a theme descriptor file where the sub-themes can be defined. Then, {$system['theme']} could be:
my_theme/steel_blue
and {$system['system_url']} could be:
www.mysite.com/wholesale_store
This allows for arbitrary flexibility where otherwise, one would need to specifically find the relevant statements and re-code all templates in a theme.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development 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