Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Filebrowser link in Vanilla

edited July 2005 in Vanilla 1.0 Help
Howdy all.

I'd love to add another box next to "Discussions", "Categories", etc with a user-definable text and link. My goal would be to call it "Family Photos" and link it to the "images/" directory.

I'm currently using phpBB for my family's website - though - it's like using a sledgehammer to kill a fly. Vanilla seems like the perfect flyswatter - adding the "Family Photos" link at the top would just be the finishing touch for me.

PS - Rock on Vanilla!


  • MarkMark Vanilla Staff
    edited July 2005
    1. Create a file in your extensions directory called "Filebrowser.php"
    2. Open up the file and add the following lines at the top (this information will appear in the extensions management form when you are in Vanilla > Settings).

    <? /* Extension Name: Filebrowser Tab Extension Url: Description: Adds a filebrowser link to the tab menu Version: 1.0 Author: Your name goes here Author Url: */

    3. Now add the code that will make the tab appear on the required pages:

    if (in_array($Context->SelfUrl, array("index.php", "categories.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))) { $Menu->AddTab("Family Photos", "family_photos", "./images/", "PhotosTab"); } ?>

    4. Save the file.
    5. Sign into vanilla with an administrative account. Go to settings > Manage Extensions.
    6. Find your extension and enable it.

    That should get you what you want.
  • Wow thanks Mark!

    ... though, instead of my name going there, shouldn't it be yours? :)
  • MarkMark Vanilla Staff
    hahaha - No. Make it yours. You'll be the only one with the extension anyway. And it *was* your idea :)
  • heh, thanks.

    so, one more question ~

    If I wanted that link to open up in a new window / tab, would it have something to do with this part:


    Or is there something else entirely I'm not qualified to know right off the bat?
  • that checks to see what page you are on (pages that display the tab menu) before it tries to add the tab to the list.

    i noticed with this mark is there a way to specify the order?

    also i don't htink there is a way to open the link in a new window... though i didn't actually look in the Menu class
  • MarkMark Vanilla Staff
    jonezy - Yes, I'm pretty sure you can specify order. I'll have to look at the code again to be sure.

    You can do a hack to open the link in a new window. The easiest way is to just change that third param from "./images/" to "'./images/');"
  • doh, problem, help!

    I tried the above, and now when I comment I get:

    Warning: Cannot modify header information - headers already sent by (output started at /home/eiugmord/public_html/vanilla/extensions/FilebrowserTab.php:28) in /home/eiugmord/public_html/vanilla/controls/Common.Controls.php on line 123

    any ideas?
  • actually... nevermind... heh.

    my text editor was adding about 10 carriage returns to the end of the file. doh.
  • awesome! i was looking for a way to accomplish this myself!

    anyway to make it add a tab to a different area instead of right at the beginning of the navigation?
  • MarkMark Vanilla Staff
    I'll have to look into that one. I know I made a "position" option on the addtab method, but I'm not sure it's working 100% correctly. I'm starting on the extension documentation now. If I find as I'm writing and referencing that it doesn't work, I'll have to fix that for Friday's release.
This discussion has been closed.