Skip to content

dart-creations.com

Advertisement
Home arrow Joomla arrow Joomla Tips and Tricks arrow #30 - Sticky Template Chooser

Print E-mail

 #30 - Sticky Template Chooser (or allowing your users to choose their own Joomla template)

The Template Chooser, is one frustrating module. The first time you see it, you think that it's there to allow your users to choose their own templates. You enable it and leave it there, but you realise that it actually reverts to the default template.

 With this small hack, you can ensure that the Joomla template your users choose via the Template Chooser, remains there always (or at least as long as the cookie lasts Laughing)

Find the following lines in includes/joomla.php. There's a cookie setting for the tempalte which lasts only 10 minutes. To extend it, reset the time to your choosing. In Joomla 1.0.13 see lines 1288-1295:

// check that template exists in case it was deleted
if (file_exists( $mosConfig_absolute_path .'/templates/'. $jos_change_template .'/index.php' )) {
$lifetime = 60*60*24*365; // *dr* change it from 60x10 (=10 minutes) to 60*60*24*365 (=365 days) to save template choice for 365 days;
$cur_template = $jos_change_template;
setcookie( 'jos_user_template', "$jos_change_template", time()+$lifetime);
} else {
setcookie( 'jos_user_template', '', time()-3600 );
}

That's it ... your user choosable template now lasts for a year. 

Comments
Add NewSearchRSS
Admin - Great IP:222.240.253.30 | 2008-02-02 13:31:07
tnx man, great help
Write comment
Name:
Title:
Security Image
 

Subscribe to our feed


RSS Feed

DART Creations - Joomla Tutorials, Tips and Tricks and more...

Joomla Tips

DART Creations Joomla Tips, Tricks, tutorials and general Joomla help

Sponsors

Buy us a beer!

Lots of time and effort goes into creating and maintaining this site. If we've helped you, consider buying a beer. It will inspire us to keep on giving! Thanks! (€3)






Cheers ;)