There are many destinations you can go with.
1) "CSS ZEN"
Here the markup remains unchanged, but you are completely redesigning just using CSS and images. Demonstrated very well at http://www.csszengarden.com/
2) MVC style
Here you create a model that represents page data and then passes it to a view containing some built-in echo instructions. The idea is that you can send the same model to a completely different view so that it looks completely different: HTML and that’s it. Cake PHP is a good start to this: http://cakephp.org/
Example:
<div class="content"> <? echo $Page->Content ?> </div>
3) Micro-marking
Using this method, you add your own “special tags” to the HTML page. Then you read on your simple HTML page and replace the special tags with the information you want to display. This is good if you want your templates to be recognizable for HTML guys who don't know PHP and can break PHP code in an MVC application.
Example:
<div class="content"> <#Content#> </div>
Out of all of this, MVC is a very structured way to achieve what you want - however, I have listed other options as they are for specific scenarios that may be relevant to you.
I implemented the concept in all three of them, in situations that were suitable for everyone.
Regarding editing in question
I assume you will have “something” representing your user - this is easy:
(In case you just need to undo a few settings ...)
<link href="style.css" type="text/css" rel="stylesheet"> <?php if ($User->Type === USER_ADMIN) { ?> <link href="admin.css" type="text/css" rel="stylesheet"> <?php } ?>
This example can be configured as follows:
- Use a switch statement if there are many types of users
- If the replacement is complete, and not just a few overrides, you can completely change the stylesheet.
source share