TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,022
  • Total Topics: 21,332
  • Online today: 473
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 155
  • Total: 155

Block or Article: Social Bookmarks snippet

Started by knat, February 24, 2007, 12:12:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knat

I found this script that i now use on my site.. maybe other want it too.. Social bookmarking is the big thing on the web  ;)

Works in php article or php block.. remember to upload the images  ;)



echo'<center>';
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; }
function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }

function soc_bookmark($link, $title, $icon = 'Y') {
    $feed = 'feed';
    $link = rawurlencode($link);
    $title = rawurlencode($title);
    $icon_folder = 'bookmarks/icons/';
    $bookmark = array(
        'protopage'=>
'http://www.protopage.com/add-button-site?url='.$link.'&label='.$title.'&type='.$feed,
        'pubsub'=>
'http://www.pubsub.com/index.php?q='.$link,
        'IceRocket'=>
'http://blogs.icerocket.com/search?q='.$link,
        'digg'=>
'http://digg.com/submit?phase=2&url='.$link,
        'BlinkBits'=>
'http://www.blinkbits.com/bookmarklets/save.php?v=1&source_url='.$link.'&title='.$title,
        'BlogMarks'=>
'http://blogmarks.net/my/new.php?mini=1&simple=1&url='.$link.'&title='.$title,
        'Del.icio.us'=>
'http://del.icio.us/post?v=2&url='.$link.'&title='.$title,
        'Fark'=>
'http://cgi.fark.com/cgi/fark/edit.pl?new_url='.$link.'&title='.$title,
        'Furl'=>
'http://www.furl.net/storeIt.jsp?t='.$title.'&u='.$link,
        'Google'=>
'http://www.google.com/bookmarks/mark?op=add&bkmk='.$link.'&title='.$title,
        'Ma.gnolia'=>
'http://ma.gnolia.com/bookmarklet/add?url='.$link.'&title='.$title,
        'MyWeb'=>
'http://myweb2.search.yahoo.com/myresults/bookmarklet?t='.$title.'&u='.$link,
        'Netscape'=>
'http://www.netscape.com/submit/?U='.$link.'&T='.$title,
        'NetVouz'=>
'http://netvouz.com/action/submitBookmark?url='.$link.'&title='.$title,
        'Newsvine'=>
'http://www.newsvine.com/_tools/seed&save?u='.$link.'&h='.$title,
        'RawSugar'=>
'http://www.rawsugar.com/pages/tagger.faces?turl='.$link.'&tttl='.$title,
        'Reddit'=>
'http://reddit.com/submit?url='.$link.'&title='.$title,
        'Scuttle'=>
'http://www.scuttle.org/bookmarks.php/maxpower?action=add&address='.$link.'&description='.$title,
        'Shadows'=>
'http://www.shadows.com/features/tcr.htm?url='.$link.'&title='.$title,
        'Simpy'=>
'http://simpy.com/simpy/LinkAdd.do?title='.$title.'&href='.$link,
        'Slashdot'=>
'http://slashdot.org/bookmark.pl?url='.$link.'&title='.$title,
        'Spurl'=>
'http://www.spurl.net/spurl.php?url='.$link.'&title='.$title,
        'Technorati'=>
'http://technorati.com/faves?add='.$link.'&title='.$title,
        'Wists'=>
'http://wists.com/r.php?c=&r='.$link.'&title='.$title,
    );
    foreach($bookmark as $key=>$value) {
        $link_text = $icon == 'Y' ? '
<img src="'.$icon_folder.str_replace(".", '', strtolower($key)).'.jpg"
border="0" alt="Post to '.$key.'" />' : $key;

        echo '<a href="'.$value.'"
title="Post to '.$key.'" target="_blank">'.$link_text.'</a> ';
    }
}


soc_bookmark(selfURL(), $definePageTitle);

echo'</center>';



This is how it looks in the forum.. It allows your members to easely add you page to their favourite social bookmarking software.


The protopage bookmark will add your page RSS feeds to the users protopage. This can be changed easely if you only want to add the bookmark !

Enjoy  ;)

Code updated with more links  :)

knat

Code updated - very usefull script - does nobody want to use this ? Please debate if this is a good or bad thing to have on a forum  ???  ::)

ianus

#2
Greetings!

I'm not sure if I like the idea of social bookmarks or not.
Personally I don't use this services. I have the scrapbook plugin for my Firefox to keep interesting informations.
On the other hand I found some usefull links at sites of this kind. Sometimes this bookmarks are more useful than google.
To offer this kind of quick link & bookmark is a nice service anyway.
I integrated your code into my test page. As a side block at the moment but when I add TP to my ââ,¬Å"runningââ,¬Â board I plan to put it in a center block, maybe.

If somebody want so see this code in action
http://www.firopolis.de/forum/index.php
(code disabled)

So, I have to send a big ââ,¬Å"Thank youââ,¬Â for sharing this snipped.

IchBin

Don't use them myself either, so I can't really give you a good answer to that. :)

brianjw

I don't use them but I like it for the sake of my members on my website. Hey, one of them is bound to be using atleast one of those :D

:up: GOOD THanks

Brianjw

DawnsWebDesigns

This block didn't work for me.  Made my index page disappear.  Luckily the block admin came back so I could delete it. :(

knat

That sounds very strange.. im glad you was able to recover your index page.. you must have done something wrong.. did you remember to upload the images ? This snippet works fine on my page so again i must say i dont know why it did not work for you.

ianus

Greetings!

Maybe one of the given urlââ,¬â,,¢s of one service have changed?
I run this script since my first message in this post without any problems.

Two days ago my host wrote me, that I nearly reached the maximum of my webspace. A quick look shows that the error log causes this. (561 pages uses 120mb of webspace)
All errors look like this:

8: Undefined variable: definePageTitle
File: /is/htdocs/wp1025805_KTQRXQ5E3I/www/forum/Themes/default/BoardIndex.template.php (eval?)
Line: 78


After I disabled this block, no new errors appear in the log.
I canÃ,´t figure out the reason. This script was running very well and I havenÃ,´t changed the sources of SMF or TP, no new block, no new article.

I see a white page when I test some of the snippeds, for example the really great USER CP - An alternative to Profile Screen causes this and I think, that this behavior depends on the SMF Version.

So it might be possible that my SMF Version (1.0.6) only bring up an error while it made the index disappear when 1.1.x is in use.
But I have no idea if this guess is correct.

G6Cad

We will just have one answer for you and that will be to UPGRADE you forum.

We have no support for your versions any more, most bugs and issues that were present in your setup is fixed.
So i suggest you upgrade your forum and then upgrade your TP aswell.

ianus

Greetings!

I havenââ,¬â,,¢t send a question but try to help figuring out the problem with some information input.
This code does not depend on SMF code and the latest TP (0.9.7) can handle the script.
So the only solution I can imagine, is a change in the part of the code, that points to a 3th party site.

As mentioned, this code was working very well and I know that other snippeds, especial when they are using the SMF database or some parts of the source code, wonââ,¬â,,¢t work with my outdated SMF.

And I know that itÃ,´s time for an update but a huge part of my contend based on the Table From CSV mod. This one isnââ,¬â,,¢t available for 1.1.x and as long there is no newer version I am stuck.

I would love to use some of the snippeds but I never blame anybody because they arenÃ,´t compatible with my software. I use the ideas and change the code, in some cases (the ââ,¬Å"Ausrufââ,¬Â box at my frontpage for example). In other cases I put the thread to my favorites and keep them till I can update.

And finally, TP Version 0.9.7 installs without any problems and is up and running ââ,¬â€œ without SMF 1.1.x and all the problems (like stupid search funktion, chaptcha Problems, ââ,¬Â¦) I can read about.

So I suggest (as politely as possible) that you leave me the choice of software that fits to my needs ââ,¬â€œ tabels example 1 / Example 2

Now both positions a clear and I would prefer to use this thread to figure out what causes the problem of DawnsWebDe

This website is proudly hosted on Crocweb Cloud Website Hosting.