Created
September 8, 2011 05:57
-
-
Save justinpeterman/1202734 to your computer and use it in GitHub Desktop.
global scope variable
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 | |
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; | |
?> |
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 | |
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