Social Bookmarking Code

by 5 replies
7
Hi, folks

I'd like to put a row of social bookmarking icons on a non-WP site with php-enabled pages and have the links automatically generate the page title and URL.

I know about the AddThis and AddtoAny widgets and they work fine, I guess, but I'd like something a bit more streamlined.

I found some javascript that's simple to modify with my details (I don't want to post it here in case it's proprietary code), but it's a bit much, really. I don't want every page to have to load so much javascript via a php-include.

Does anyone have a more elegant solution (which can be shared in a public forum)?

Alternatively... if you sell some app or code that does what I'm looking for, please PM me.

Thanks very much!
TheNightOwl
#programming #bookmarking #code #social #social bookmarking
  • Why don't you simply create icons with links to the social bookmarking sites?

    For example for reddit:
    Code:
    ]
  • Thanks, Michael

    That's a really super simple solution (which we all like)! That's a great way of putting these kinds of links on the homepage, say (or any other page). I like it.

    What I'm looking for, though, is something that I can put into a php-include so that it appears on every article or "blog" post on my site and dynamically generates the title and URL of the page to submit.


    Thanks!

    TheNightOwl
  • It's hard to say without knowing the structure of your pages.

    Don't you generate the title of your page in PHP? I mean, you should have some variable with your title in it, that you can also use for the social bookmarking link.

    Maybe you have something like this in your PHP code:
    Code:
    echo '<title>' . [variable] . '</title>';
    Very simple code indeed, but I hope you understand what I want to say .

    The same is true for the link. The link TO your page is most likely generated somewhere in your PHP code, which means that you could also generate it ON the page.

    In addition to that, you can also read the URL from server variables:
    How To Find The Current URL In PHP | Learn PHP Online
    • [ 1 ] Thanks
  • Heya, Michael

    Thank you very much! I think I may have worked it out...

    I can't post the code here (with the variables, etc.) without it turning into a dog's breakfast. So I've attached it to this post in a text file.

    I tested it (uploaded it to the server and clicked the link) and it seemed to work, reducing a truck load of javascript down to a line and a half of php.

    Great stuff. Much appreciated.

    TheNightOwl

    P.S.
    I'm not a coder, btw, so have I overlooked anything?

    P.P.S. I also found this huge list of submission links. It's formatted for WP, but the base is all ready to go!
    Social Bookmarking Link Codes for 33 of the Biggest | Pro Blog Design

    Oh, and these:

    72 Sets of Free Social Bookmarking Icons - Icons - Geek Sucks

    75 Beautiful Free Social Bookmarking Icon Sets | Blog Godown



    .
    • [1] reply
    • You may have to convert the title if it includes special characters and the code doesn't work for URLs that include a script and a query, but basically the code is correct.

Next Topics on Trending Feed