Created
December 11, 2011 04:08
-
-
Save iaindooley/1458242 to your computer and use it in GitHub Desktop.
Conditional Includes in Template Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When the user is not logged in: | |
<div id="content" class="noSidebar"> | |
<div id="main"> | |
<!-- STUFF GOES IN HERE //--> | |
</div> | |
</div> | |
Now imagine that for some really good technical reason, we need to remove that noSidebar class when we add a sidebar: | |
<div id="content" class="withSidebar"> | |
<div id="main"> | |
<!-- STUFF GOES IN HERE //--> | |
</div> | |
<div id="sideBar"> | |
<!-- SOME OTHER STUFF GOES IN HERE //--> | |
</div> | |
</div> | |
The designer/template implementor simply creates two files: | |
my_interface.html | |
my_interface_logged_in.html | |
The developer then chooses which one to load according to whatever login system they're using: | |
if($security->loggedIn()) | |
$template = $this->loadTemplate('my_interface_logged_in.html'); | |
else | |
$template = $this->loadTemplate('my_interface.html'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment