Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

New Extension: Social Bookmarks

edited December 2006 in Vanilla 1.0 Help
EDIT: Its been released Social Bookmarks 1.0

Below is the new extension I'm working on. I need just a slight bit of help before I release this one. Basically I want it to have the same functionality where it will highlight the option while hovering over instead of adding a underline below the text option. Secondly, I would need to add a header above it that says "Social Bookmarks" with an underline below it. The code is below, does anyone think they can help a new developer out? Thanks in advance.


<?php
/*
Extension Name: Social Marks
Extension Url: http://lussumo.com/docs/
Description: Allows the user to add any page from a Vanilla forum to his

del.icio.us, digg, or furl account.
Version: 1.0
Author: JP Mitchell
Author Url: http://www.resn.biz
*/

if(in_array($Context->SelfUrl, array("index.php", "categories.php",

"comments.php", "search.php", "post.php", "account.php", "settings.php"))){
$socialmarks =
ENDCODE;

$Panel->AddString($socialmarks,false);
}
?>
«1

Comments

  • I recon if you use: $socialmarks = <<< ENDCODE <div class="javascriptcode"> <h2><? echo $Context->Dictionary["SocialMarks_Title"]; ?></h2><ul> <li><a href="javascript:location.href='http://digg.com/submit?phase=2&url='+encodeURIComponent(document.location.href)+' '"><? echo $Context->Dictionary["SocialMarks_PostToDigg"]; ?></a></li> <li><a href="javascript:location.href='http://del.icio.us/post?v=2&url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title)+''"><? echo $Context->Dictionary["SocialMarks_PostToDelicious"]; ?></a></li> <li><a href="javascript:location.href='http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(document.location.href)+'&t='+encodeURIComponent(document.title)+''"><? echo $Context->Dictionary["SocialMarks_PostToFurl"]; ?></a></li> </ul></div> ENDCODE; And add the dictionary definitions at the top of your file it should do the trick.
  • How would I render the dictionary definitions? Is it like this? $Context->Dictionary["SocialMarks_Title"] = "Social Bookmarks"; $Context->Dictionary["SocialMarks_PostToDigg"] = "Post to Digg"; $Context->Dictionary["SocialMarks_PostToDelicious"] = "Post to del.icio.us"; $Context->Dictionary["SocialMarks_PostToFurl"] = "Post to Furl"; Or am I just doing the wrong thing with it?
  • I think so. That's how other extensions do it. Why are you using that 'false' bit in your AddString method?
  • Hmmm, thats how I placed it in the default.php file. For some reason its not showing up on my forum in the panel.
  • ahh cool ... I'll be interested to see how you did this ... as I just "hacked" it into http://www.studiowhiz.com he he he
  • Try changing: $Panel->AddString($socialmarks,false); to: $Panel->AddString($socialmarks,150); JP.
  • Mini, I just did and nothing happened. Is there anything in your code that you first post back to me that could be causing it to not display correctly or at all? I only ask because it was working fine in the panel with my original coding. But of course, my original coding wasn't helping with the whole highlighted hover effect.
  • This is what the output looks like in the page source when viewed through the browser: <h2><? echo Array["SocialMarks_Title"]; ?></h2><ul> <li><a href="javascript:location.href='http://digg.com/submit?phase=2&url='+encodeURIComponent(document.location.href)+' '"><? echo Array["SocialMarks_PostToDigg"]; ?></a></li> <li><a href="javascript:location.href='http://del.icio.us/post?v=2&url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title)+''"><? echo Array["SocialMarks_PostToDelicious"]; ?></a></li> <li><a href="javascript:location.href='http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(document.location.href)+'&t='+encodeURIComponent(document.title)+''"><? echo Array["SocialMarks_PostToFurl"]; ?></a></li> </ul> Maybe that'll help define the problem of it actually displaying in the browser.
  • Mr K, your theme rocks....
  • Hmm. I'm not sure about these php echos within a function. Try this: $socialmarks = <<< ENDCODE <div class="javascriptcode"> <h2>$Context->Dictionary["SocialMarks_Title"]</h2><ul> <li><a href="javascript:location.href='http://digg.com/submit?phase=2&url='+encodeURIComponent(document.location.href)+' '">$Context->Dictionary["SocialMarks_PostToDigg"]</a></li> <li><a href="javascript:location.href='http://del.icio.us/post?v=2&url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title)+''">$Context->Dictionary["SocialMarks_PostToDelicious"] </a></li> <li><a href="javascript:location.href='http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(document.location.href)+'&t='+encodeURIComponent(document.title)+''"></a></li> </ul></div> ENDCODE;
  • That didnt work either. Thanks for trying to help out. When you remove the echo, it actually displays those words.
  • edited July 2006
    Right. It doesnt help i was using the dictionary wrong. The following code works (as far as interface is concerned, it might not work with the actual links). In brutal honesty, i dont quite understand how the whole <?php /* Extension Name: Social Marks Extension Url: http://lussumo.com/docs/ Description: Allows the user to add any page from a Vanilla forum to their del.icio.us, digg, or furl account. Version: 1.0 Author: JP Mitchell Author Url: http://www.resn.biz */ $Context->Dictionary['SocialMarks_Title'] = 'Social Bookmarks'; $Context->Dictionary['SocialMarks_PostToDigg'] = 'Post to Digg'; $Context->Dictionary['SocialMarks_PostToDelicious'] = 'Post to del.icio.us'; $Context->Dictionary['SocialMarks_PostToFurl'] = 'Post to Furl'; if (in_array($Context->SelfUrl, array('index.php', 'categories.php','comments.php','search.php','post.php','account.php','settings.php'))) { $socialmarks = '<div class="javascriptcode"> <h2>'.$Context->GetDefinition('SocialMarks_Title').'</h2><ul> <li><a href="javascript:location.href=\'http://digg.com/submit?phase=2&url=\'+encodeURIComponent(document.location.href)+\' \'">'.$Context->GetDefinition('SocialMarks_PostToDigg').'</a></li> <li><a href="javascript:location.href=\'http://del.icio.us/post?v=2&url=\'+encodeURIComponent(document.location.href)+\'&title=\'+encodeURIComponent(document.title)+\'\'">'.$Context->GetDefinition('SocialMarks_PostToDelicious').'</a></li> <li><a href="javascript:location.href=\'http://www.furl.net/storeIt.jsp?u=\'+encodeURIComponent(document.location.href)+\'&t=\'+encodeURIComponent(document.title)+\'\'">'.$Context->GetDefinition('SocialMarks_PostToFurl').'</a></li> </ul></div>'; $Panel->AddString($socialmarks,false); } ?>

    Have fun. I'm going to get some sleep :D

    Haha. It just struck me your whole aim was to get the highlighting going and not with the underlines so i kinda missed the whole bill here (though i did get language capabilities in for you, go me!). I actually have no idea why it's not highlighting though - the code (as far as i can see) is identical now (as far as html tags go) with the rest of the stuff in the side panel. I'm confused =\ I'm sure someone will be able to shed some light on it though.
  • Thanks for all your help Minisweeper. Unfortunately, that didn't work either. After more thought, I went a different direction.

    Social Bookmarks 1.0
  • You can see a modified version of Social Bookmarks 1.0 in action at the Real Estate Social Network, my Vanilla forum.

    I have modified it so only 12 social bookmark services are displayed.
  • Cool beans, Would be slightly better if you got rid of the yahoo one so it was in line, but it's looking nice anyway! :P
  • Weird, I dropped this one in my extension folder and its not showing up in my extensions list in Vanilla... I have a lot of other extensions installed could that be causing some sort of conflict?
  • Did you make sure that its in a folder of its own, like "your_vanilla_path/extensions/SocialBookmarks"?
  • edited July 2006
    Yep thats exactly the folder it is in.... And this is what I have installed/activated, not sure if its something conflicting? just kinda weird, any other extensions i drop in seem to show up in the list. Announcement 1.1 Audioscrobblerizer 0.1 Better BB Code 1.0 Category Jumper 1.0 Flickrizer 0.1 Html Formatter 1.3 Legends 1.0 LiveSearch 1.0 Next Unread Discussion 1.0 Page Management 2.3 Panel Lists 1.0 Poll 1.1 RSS2 Feed 1.0 Role History 1.0 Smooth Page Jump 1.0 Forum Statistics 0.2.8 Custom Styles 2.0 Text Mode Switch 1.0 UserInfo Tooltip 1.0 Whisper Notification 0.1 Who's Online 1.1 Comments Permalinks 1.0 digg.com 0.0.1
  • Check that the first couple of lines of the extension are correct. It needs the following parameters:
    /*
    Extension Name:
    Extension Url:
    Description:
    Version:
    Author:
    Author Url:
    */
  • That did the trick, JP Mitchio's missing the 'Extension Url:' in this script.
This discussion has been closed.