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

User Extension Hook in automagically created filename

 
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
Cloggs
Smarty Rookie


Joined: 16 May 2003
Posts: 8
Location: United Kingdom

PostPosted: Fri May 16, 2003 10:26 am    Post subject: User Extension Hook in automagically created filename Reply with quote

Smarty does bring many benefits to developing a multilingual, multi-browser compatible websites, but ...

Placing browser dependent conditional clauses for example to trigger meta tags links for Opera, or suppress SmartTags for explorer, or deal with the different browser interpretations on CSS stylesheets clashes with Smarty's compiling and caching funtionality.

Simply put the users browser which triggers the compilation determines what is placed in the cache for the lifetime of the cached file. Any user picking up the cached file will get that file even if the user uses another type of browser.

We have resorted to a small hack in the Smarty::_get_auto_filename() function where at the top of the function the auto_source variable which contains the template file name is rewritten. In this function the template file name is virtual and by adding browser,language and some other stuff to it, it becomes even more automagical.

Effectively the hack allows one template to be maintained with browser, language etc conditions in it, whilst on compilation and caching Smarty creates seperate files based on the virtual file name.

Now it would very nice if a simple configuration hook to an optionally defined user function could be built into Smarty. That way Smarty future upgrades do not require the hack directly into the Smarty class to be perpetuated.
Back to top
View user's profile Send private message
sweatje
Smarty Regular


Joined: 17 Apr 2003
Posts: 70
Location: Bettendorf, Iowa, USA

PostPosted: Fri May 16, 2003 11:03 am    Post subject: Reply with quote

Was there a reason that some combination of browser/language settings in your cache_id/compile_id was not sufficient?
_________________
Jason
jsweat_php AT yahoo DOT com
Back to top
View user's profile Send private message
Cloggs
Smarty Rookie


Joined: 16 May 2003
Posts: 8
Location: United Kingdom

PostPosted: Fri May 16, 2003 12:44 pm    Post subject: Reply with quote

Hmm, a clear case of RTFM (or the Smarty php source file for this matter).

Indeed the compile_id does do the trick as the browser/language etc information I mentioned is static.

Good to see that the feature rich Smarty environment does not need even more features but merely a better understanding of its exsting features by its users.

Thank you.
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