Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD/ADDON] Social bookmarking feature (converted by burtrito)  (Read 2032 times)

centered

  • Guest

Untested here, but since I am doing 1.4 atm why not..

Thread here: http://snewscms.com/forum/index.php?topic=2052

Quote from: Mika
Full article with modding explanation can be found on http://www.ni5ni6.com/snews-mods/allround-social-bookmarking-script/

EDIT: fixed bug (by iatbm)

1. You know the drill :D backup first!
2. Add this code into your snews.php file (I usually put all my mods near the code where is the action ;) ) but you can paste it anywhere you want
Code: [Select]
<?php
// MOD - SOCIAL BOOKMARKING
function soc_bookmark($link$title$icon 'Y') {
    
$link rawurlencode($link);
    
$title rawurlencode($title);
    
$icon_folder 'icons/';
    
$bookmark = array(
        
'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,
        
'Digg'=>'http://digg.com/submit?phase=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("."''$key).'.jpg" alt="'.l('soc_bookmark').' '.$key.'" />' $key;
        echo 
'<a href="'.$value.'" title="'.l('soc_bookmark').' '.$key.'">'.$link_text.'</a> ';
    }
}
?>
3. Download the icon package and place the folder named icons inside your site root;
4. Add this code inside language variables into function l()
Quote
$l['soc_bookmark'] = 'Post to';
5. Add this code inside function center()
Quote

echo '<p>'.l('soc_bookmark').': ';
soc_bookmark(db('website').$category.'/'.$r['seftitle'].'/', $r['title'], 'Y');
echo '</p>';

file_include(str_replace('[break]', '', $text), $shorten);
...
Quote from: burtrito
I made some small changes to get this working on snews 1.4:

The 1.5 mod above uses the following code in the center function:

Code: [Select]
echo '<p>'.l('soc_bookmark').': ';
soc_bookmark(db('website').$category.'/'.$r['seftitle'].'/', $r['title'], 'Y');
echo '</p>';
If you have 1.4, use the below in the center function:

Code: [Select]
echo '<p>'.l('soc_bookmark').': ';
soc_bookmark($s .s('website').$category.'/'.$r['seftitle'].'/', $r['title'], 'Y');
echo '</p>';
I added mine below

Code: [Select]
if ($category <> s('home')) { $category = $category. "/"; }I also had to alter the filenames of the icons to include an Uppercase first letter. e.g: Digg.jpg instead of digg.jpg (MyWeb.jpg and BlogMarks.jpg require two case changes)

Use the rest of Mika's code as instructed.
« Last Edit: August 25, 2007, 03:28:04 am by Phil Martin (Philmoz) »
Logged