• Home (current)
  • Categories
  • News
  • Blog
  • Online Tools How To Submit Software Contact
    • Register Login

    Generate javascript share buttons with PHP

    • Wendy
    • December 6, 2017
    • 542

    Here is self-explanatory PHP function that will help you to generate Social Sharing links easily.

    function share($to, $title, $url)
    {	$url = urlencode($url);	$title = urlencode($title);	switch ($to) {	case 'facebook':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://www.facebook.com/share.php?u=$url&title=$title\" ";	break;	case 'twitter':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://twitter.com/home?status=$title+$url\" ";	break;	case 'google+':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"https://plus.google.com/share?url=$url\" ";	break;	case 'tumblr':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://www.tumblr.com/share?v=3&u=$url&t=$title\" ";	break;	case 'pintrest':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://pinterest.com/pin/create/bookmarklet/?url=$url&is_video=false&description=$title\" ";	break;	case 'linkedin':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://www.linkedin.com/shareArticle?mini=true&url=$url&title=$title\" ";	break;	case 'reddit':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://www.reddit.com/submit?url=$url&title=$title\" ";	break;	case 'stumbleupon':	return " onclick=\"javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;\" href=\"http://www.stumbleupon.com/submit?url=$url&title=$title\" ";	break;	default:	return "";	break;	}
    }

    To use it, just call the the function with appropriate params

    echo share("facebook", "Page Title", "http://page.com/link.html");

    You May Also Like View all


    Big list of various character length usernames

    Big list of various character length usernames

    Search Amazon by Image or text from right click menu

    Search Amazon by Image or text from right click me...

    10 Breakthrough Technologies in 2018

    10 Breakthrough Technologies in 2018

    Google kills View Image button from image search-With easy fix

    Google kills View Image button from image search-W...

    Audio Repair-Editing Tools and Techniques

    Audio Repair-Editing Tools and Techniques

    How to create SitemapIndex sitemap from database

    How to create SitemapIndex sitemap from database

    Most Read
    • 17 Best Free Word to PDF Converter Software for Windows
    • Big list of sample videos for testers
    • How to remove Omiga Plus?
    • 5 Best Free Video Repair tools to Fix Any Video
    • How to remove Adchoices?
    Popular Downloads
    • Adobe Flash PlayerAdobe Flash Player
    • PDF24 CreatorPDF24 Creator
    • Free Word to PDF ConverterFree Word to PDF Converter
    • Free PDF ReaderFree PDF Reader
    • Ghost Mouse Auto ClickerGhost Mouse Auto Clicker
    • HD Youtube Downloader FreeHD Youtube Downloader Free
    • PageNest Free EditionPageNest Free Edition
    • MP4 Video Repair ToolMP4 Video Repair Tool
    • Word into PDF ConverterWord into PDF Converter
    • Solid PDF CreatorSolid PDF Creator
    • Excel 2016 Password Remover FreeExcel 2016 Password Remover Free
    • WinRARWinRAR
    • VLC Media PlayerVLC Media Player
    • Word Excel PowerPoint to Pdf ConverterWord Excel PowerPoint to Pdf Converter
    • WinZipWinZip

    Submit Softwares - Contact - Privacy Policy - © StandaloneInstaller.com 2018