Social Bookmarking Code

5 replies
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
#bookmarking #code #social #social bookmarking
  • Profile picture of the author Michael R.
    Why don't you simply create icons with links to the social bookmarking sites?

    For example for reddit:
    Code:
    http://www.reddit.com/login?dest=/submit?[URL]&title=[title]
    {{ DiscussionBoard.errors[2403446].message }}
  • Profile picture of the author TheNightOwl
    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
    Signature
    {{ DiscussionBoard.errors[2405754].message }}
  • Profile picture of the author Michael R.
    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
    {{ DiscussionBoard.errors[2407345].message }}
  • Profile picture of the author TheNightOwl
    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



    .
    Signature
    {{ DiscussionBoard.errors[2407644].message }}
    • Profile picture of the author Michael R.
      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.
      {{ DiscussionBoard.errors[2408037].message }}

Trending Topics