Created
September 22, 2011 04:11
-
-
Save nicksheffield/1234012 to your computer and use it in GitHub Desktop.
Testing changes on a live php site without disrupting users
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
<?php | |
# dogs is the text every other user will see. | |
# "cats" is what the developer sees... | |
# This way, only the developer can see changes, and if they want to show the client, they can. | |
?> | |
<h1>Heading!</h1> | |
<p>This is some text about <?php if(!isset($_GET['dev'])): ?>dogs<?php else: ?>cats<?php endif; ?> | |
<?php | |
# useful for applying new classes too | |
?> | |
<p<?php if(isset($_GET['dev'])) echo ' class="canine"'; ?>>This is some text about dogs</p> | |
<?php | |
# or to make it easy, set it up as a constant, for example.. | |
define('DEVMODE',isset($_GET['dev'])); | |
?> | |
<h1><?php if(DEVMODE): ?>New<?php else: ?>Old<?php endif; ?> Heading</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment