Skip to content

Instantly share code, notes, and snippets.

@patriziosotgiu
Created August 8, 2015 16:35
Show Gist options
  • Save patriziosotgiu/3834d095936771573a49 to your computer and use it in GitHub Desktop.
Save patriziosotgiu/3834d095936771573a49 to your computer and use it in GitHub Desktop.
////////////////////////////////////////////////////////////////////////////////
// PHP - Show single or conditional blocks on url change
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Single
////////////////////////////////////////////////////////////////////////////////
$ads = isset($_GET['ads']) ? $_GET['ads'] : FALSE;
<?php if($ads == 'yes') : ?>
<div class="module-ad">im a html snippet area</div>
<?php endif; ?>
////////////////////////////////////////////////////////////////////////////////
// Conditional
////////////////////////////////////////////////////////////////////////////////
$version = isset($_GET['version']) ? $_GET['version'] : FALSE;
<?php if($version == '2') : ?>
show me if ?version=2
<?php elseif($pattern == '3') : ?>
show me if ?version=3
<?php else : ?>
show me by default
<?php endif; ?>
////////////////////////////////////////////////////////////////////////////////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment