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

Pulling template from database based on browser type

 
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
redbrad0
Smarty Regular


Joined: 03 Feb 2007
Posts: 41

PostPosted: Thu Feb 03, 2011 12:38 am    Post subject: Pulling template from database based on browser type Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Feb 03, 2011 5:50 pm    Post subject: Reply with quote

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
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