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

Unnecessary overhead for config_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 -> Feature Requests
View previous topic :: View next topic  
Author Message
Mike Bradley
Smarty n00b


Joined: 18 Apr 2003
Posts: 4

PostPosted: Fri Apr 18, 2003 1:13 am    Post subject: Unnecessary overhead for config_file? Reply with quote

I have been using config_file to implement language versions of my pages (the language files being selected at install time, rather than run-time), but looking at the compiled code I was wondering if these were being implemented in the best way.

It strikes me that .conf files are not intended to be changed that often, in which case could the configuration values not be inserted statically into the compiled page? Any changes to the .conf files would need to result in a recompile.

This would save the script from having to load and parse the .conf files on each page load, at least when the file is loaded with local scope.

Any downside on this? Am I correct in thinking that {# #} values are supposed to be more static than {$ } values?

Mike


Last edited by Mike Bradley on Fri Apr 18, 2003 1:16 am; edited 1 time in total
Back to top
View user's profile Send private message
Tom Sommer
Administrator


Joined: 16 Apr 2003
Posts: 47
Location: Denmark

PostPosted: Fri Apr 18, 2003 1:15 am    Post subject: Reply with quote

IIRC config files are already pre-compiled?
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Mike Bradley
Smarty n00b


Joined: 18 Apr 2003
Posts: 4

PostPosted: Fri Apr 18, 2003 1:20 am    Post subject: Reply with quote

Well what do you know - they already thought of that! I never realised that the config files were compiled as well!

Mike
Back to top
View user's profile Send private message
Tom Sommer
Administrator


Joined: 16 Apr 2003
Posts: 47
Location: Denmark

PostPosted: Fri Apr 18, 2003 1:21 am    Post subject: Reply with quote

Smile great isn't it Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Mike Bradley
Smarty n00b


Joined: 18 Apr 2003
Posts: 4

PostPosted: Fri Apr 18, 2003 2:14 am    Post subject: Reply with quote

One thing - how do I assign the values 'Yes' and 'No' in the config file?

If I do:

lsYes = Yes
lsNo = No

They get evaluated to 1 and 0 respectively

But if I do

lsYes = Ja
lsNo = Nej

They evaluate to Ja and Nej - do Yes and No have special meaning here? If I enclose in quotes, it has no effect.

Mike
Back to top
View user's profile Send private message
plockaby
Guest





PostPosted: Fri Apr 18, 2003 5:16 am    Post subject: Reply with quote

To keep from converting "yes" and "no" to 0 and 1, set the smarty variable $config_booleanize to false or set the config class variable $booleanize to false, depending on which method you're using to access your config files.

Last edited by plockaby on Wed May 05, 2010 10:49 pm; edited 1 time in total
Back to top
Mike Bradley
Smarty n00b


Joined: 18 Apr 2003
Posts: 4

PostPosted: Fri Apr 18, 2003 10:53 am    Post subject: Reply with quote

You star - it took a few goes and I had to remember to delete my cache, but it worked just fine.

Mike
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 -> Feature Requests 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