Skip to content

Instantly share code, notes, and snippets.

@justinpeterman
Created September 8, 2011 05:57
Show Gist options
  • Save justinpeterman/1202734 to your computer and use it in GitHub Desktop.
Save justinpeterman/1202734 to your computer and use it in GitHub Desktop.
global scope variable
<?php
if(!empty($GLOBALS['social_dialog'])): //Step 4: Ok, was anything generated during that pages/element loop?
echo $GLOBALS['social_dialog']; //print out the html string generated if so...
endif;
?>
<?php
function createSharingDialog($services) //Step 2: Build the dialog and save it to a var for later use
{
$social_dialog = "<div data-role='dialog' id='share_dialog'>";
$social_dialog .= "<div data-role='header'><h2>Share</h2></div>";
$social_dialog .= "<div data-role='content'>";
foreach($services as $item):
$social_dialog .= buildSharingLink($item);
endforeach;
$social_dialog .= "</div>";
$social_dialog .= "</div>";
$GLOBALS['social_dialog'] = $social_dialog;
return $GLOBALS['social_dialog'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment