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.

Adding Links to sidepanel

edited July 2010 in Vanilla 1.0 Help
How do I add external links to the sidepanel? Do I have to download a Vanilla add-on to do this? For instance, how would I insert a link to Lussumo.com into my sidepanel?
«13

Comments

  • NickENickE New
    edited June 2010
    there's probably an extension which allows you to do this, but it would neverthelesss be quite easy to make one yourself:
    <?php
    /*
    Extension Name: Sidepanel Linkage
    Extension Url: http://lussumo.com/addons
    Description: Adds a side panel link
    Version: 1.0
    Author: your name
    Author Url: N/A
    */

    if(isset($Panel))
    $Panel->AddString('your html here, single quotes escaped, ie. \' ', 100 /* specifies position */);

    ?>
  • edited January 2007
    Thanks SirNot. The 100 specifies position--meaning 100 pixels down the page? Right? I found the Sidepanel add-on, which says you can add external links into your side panel. When I add the external links to the sidebar I get a 404 error, b/c the code is appending the external URL to index.php (community) and then the categories subdirectory. When clicked, instead of going to lussumo.com, the user is directed to domain.com/community/categories/\"http://lussumo.com" Not good. Here's my code from default.php (Sidepanel add-on)... <?php if(in_array($Context->SelfUrl, array("index.php", "categories.php", "discussions.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))){ $content = <<< ENDCODE <br><strong> <font size=\"2"> My Heading Here </strong></font> <br> <a href=\"http://lussumo.com"> Lussumo</a><br> <a href=\"http://google.com"> Google</a> ENDCODE; $Panel->AddString($content,150); } ?>
  • the 100 doesnt mean 100 pixels to the right, the hundred only means that it puts it into position 100 of the panel, which means that it should be right at the bottom unless another extension has a number higher than that
  • y2kbgy2kbg New
    edited June 2010
    There are automatic ways to add links to the panel:
    $ListName = 'My Links'
    $Panel->AddList($ListName)
    $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com');
    $Panel->AddListItem($ListName, 'Google', 'http://www.google.com');
  • y2kbg - Thank you. Into which file (inside what directory) do I place the code? Vincent- Thanks for explaining how 100 is connected to placement.
  • you've got to put it inside an extension.

    the actual article in the documentation is here
  • y2kbgy2kbg New
    edited June 2010
    In an extension put:
    <?php
    /*
    Extension Name: Sidepanel Linkage
    Extension Url: http://lussumo.com/addons
    Description: Adds a side panel link
    Version: 1.0
    Author: your name
    Author Url: N/A
    */

    if(in_array($Context->SelfUrl, array("index.php", "categories.php", "discussions.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))){
    $ListName = 'My Links'
    $Panel->AddList($ListName)
    $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com');
    $Panel->AddListItem($ListName, 'Google', 'http://www.google.com');
    }
    ?>
    And like Vincent said, take a look at original documentation, it should help you understand it better.
  • edited January 2007
    Thank you y2kbg. Vincent, thanks for the link. I saved the code above as default.php and placed it inside the Sidepanel extension. When I upload it, I get the following error message... Parse error: syntax error, unexpected T_VARIABLE on line 13. Line 13 is... $Panel->AddList($ListName) What have I done wrong?
  • You need to add the ";".
  • edited June 2010
    Thanks, I added the semicolon, and I'm *still* getting the error message (yes, I've cleared the cache). Parse error: syntax error, unexpected T_VARIABLE on line 13. Here's the code: <?php /* Extension Name: Sidepanel Linkage Extension Url: http://lussumo.com/addons Description: Adds a side panel link Version: 1.0 Author: your name Author Url: N/A */ if(in_array($Context->SelfUrl, array("index.php", "categories.php", "discussions.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))){ $ListName = 'My Links' $Panel->AddList($ListName); / *This is line 13 */ $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com'); $Panel->AddListItem($ListName, 'Google', 'http://www.google.com'); } ?> What now?
  • The line above that needs a ";".
  • Thank you! No more errors now. Two remaining questions, though. 1. The links are at the very top of my sidepanel. How do I move them to the bottom of the sidepanel (below the Notification heading)? I know I should use the value of "100" to do this, but how do I add 100 into the code? 2. How did y2kbg get the yellow line to appear to the left of his code (in his forum post above)? In most forums, the tags [code] [/code] are used, but this doesn't work on Vanilla.
  • I tried adding $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com' , 100); $Panel->AddListItem($ListName, 'Google', 'http://www.google.com', 100); but this just displays the number 100 after each anchor text link. It seems like Vanilla was designed for people who are very familiar with PHP (developers), which I am not.
  • you can use html to format your comments, so put your code in between <code></code> tags.

    and if you want to reposition the list you have to add the parameter to the AddList call:$Panel->AddList($ListName, 100 /* or whatever fits best */);
  • Brilliant, it worked wonderfully. Thank you SirNot.
  • edited January 2007
    How can I make the links open in a new window?
  • <a href='' target='_blank'></a>
  • y2kbgy2kbg New
    edited January 2007
    edit: nevermind
  • edited January 2007
    Thks, still not clear on how to embed <a href='' target='_blank'></a> into an link extension? e.g.) { $ListName = 'My Links'; $Panel->AddList($ListName, 100); $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com'); $Panel->AddListItem($ListName, 'Games Room', 'http://www.vipmduncan.com/07/games.php'); $Panel->AddListItem($ListName, 'Poker T-Shirts', 'http://www.tshirtmagic.com/stock.php?action=step2&c1=282'); };
  • edited January 2007
    Well, referring to the documentation, the syntax for AddListItem is: AddListItem($ListName, $Item, $Link, $Suffix = '', $LinkAttributes = '', $Position = '0', $ForcePosition = '0'); so how about $Panel->AddListItem($ListName, 'Lussumo', 'http://www.lussumo.com', $Suffix = ''. $LinkAttributes = 'target="_blank"');?
Sign In or Register to comment.