CodeClerks

How to add template change function in PHP?



Write the reason you're deleting this FAQ

How to add template change function in PHP?

When sites update their template they give you the option to revert back to the old theme. How exactly is this done? Generally, you could add new files to the theme/template folder, or even create a new directory for the theme, but what is the best way to get this done via the database?

You could add something like:

<<?php echo $data['style']; ?>.css" media="screen" rel="stylesheet" type="text/css" />


But how would you do this with a function, so you don't have to use a directory?

 

Comments

Please login or sign up to leave a comment

Join
artbluelove
Hi, I have website and template. I could add new files to the template with my rental server.
But I still don't have the best idea. 
I didn't write code, like your code :
<<?php echo $data['style']; ?>.css" media="screen" rel="stylesheet" type="text/css" />
In addition, I use directory.. why not they could..



Are you sure you want to delete this post?

ultimate
What I generally do is to store users theme preference in a database. For each theme there is a directory containing 3 (or more) sub-directories CSS, IMAGES, JS. Now, in you just pass the theme name to the view (html) and call files from that folder corresponding to the users theme.
Make sure you have a 1:1 map across all themes or things will break.



Are you sure you want to delete this post?