|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
redbrad0 Smarty Regular
Joined: 03 Feb 2007 Posts: 41
|
Posted: Thu Feb 03, 2011 12:38 am Post subject: Pulling template from database based on browser type |
|
|
Inside both of the below functions I run a query to pull the template. What my thought was to pull the browsers template but if it unavailable then to pull the default template. The question's I have are as follows. FTI I am using Smarty 3
1. If I try to load index.tpl and then inside the db_get_timestamp it finds that index.tpl.iphone is available and loads it, wouldnt it save the template into the cache folder for index.tpl and not index.tpl.iphone?
2. Is there a way I can pass the template name back through smarty so I can tell db_get_template which template I want it to load?
function db_get_template ($tpl_name, &$tpl_source, $smarty_obj) {
function db_get_timestamp($tpl_name, &$tpl_timestamp, $Smarty_obj) { |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Feb 03, 2011 5:50 pm Post subject: |
|
|
1. Smarty will store compiled and cache files under the names originally passed to Smarty.
2. It's not possible to return a different template name |
|
Back to top |
|
|
|
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
|