PHP Echo will not give my result?
|
02-21-2013, 08:26 AM
Post: #1
|
|||
|
|||
PHP Echo will not give my result?
Hi,
The Code is working in Original if i add in Wordpress and I want to add it to my CMS too but Echo does not give me any result. <?php error_reporting(E_ALL); function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $siteurl = curPageURL(); function simple_social_sharing($attr_twitter = null, $attr_items = null) { // parse variables $twitter_account = $attr_twitter; $item_toggles = $attr_items; // create share items array $share_items = array(); // set each item $item_facebook = array( "class" => "facebook", "href" => "http://www.facebook.com/sharer.php?u={$siteurl}&t={$browser_title_encoded}", "text" => "Share on Facebook" ); $item_twitter = array( "class" => "twitter", "href" => "http://twitter.com/share?text={$page_title_encoded}&url={$siteurl}&via={$twitter_account}", "text" => "Share on Twitter" ); $item_google = array( "class" => "google", "href" => "http://plus.google.com/share?url={$siteurl}", "text" => "Share on Google+" ); // test whether to display each item if ($item_toggles) { // explode into array $item_toggles_array = explode(",", $item_toggles); // set each item on or off $show_facebook = $item_toggles_array['0']; $show_twitter = $item_toggles_array['1']; $show_google = $item_toggles_array['2']; } else { $display_all_items = 1; } // form array of items set to 1 if ($show_facebook == 1 || $display_all_items) { array_push($share_items, $item_facebook); } if ($show_twitter == 1 || $display_all_items) { array_push($share_items, $item_twitter); } if ($show_google == 1 || $display_all_items) { array_push($share_items, $item_google); } // if one or more items if (!empty($share_items)) { // create output $share_output = "<ul class=\"ss-share\">\n"; foreach ($share_items as $share_item) { $share_output .= "<li class=\"ss-share-item\">\n"; $share_output .= "<a class=\"ss-share-link ico-{$share_item['class']}\" href=\"{$share_item['href']}\" rel=\"nofollow\" target=\"_blank\">{$share_item['text']}</a>\n"; $share_output .= "</li>\n"; } $share_output .= "</ul>"; } return $share_output; } // add shortcode to output buttons function simple_social_sharing_shortcode($atts, $content = null) { // parse variables / set defaults extract(shortcode_atts(array( 'twitter' => '', 'display' => '1,1,1' ), $atts)); // output buttons ob_start(); simple_social_sharing($twitter, $display); $output_string = ob_get_contents(); ob_end_clean(); return force_balance_tags($output_string); } echo simple_social_sharing($share_output[item_facebook]); ?> Its just not showing.. I think I echo it wrong or i have Errors inside. Just checked again the Code if I have any Errors but there is nothing highlighted as Error. Ads |
|||
02-21-2013, 08:34 AM
Post: #2
|
|||
|
|||
Well, are you getting any errors? or it's just not showing up?
Make sure you have everything closed properly, have quotations around text and that semi-colon; at the end. Ads |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)