[HOW-TO] Add new tab in Clip-Bucket’s navigation menu

Written by Richi González Wednesday, 29 December 2010

Hello,

This is my first post, hope it helps people that want to know how to add a new item in the navigation.

I always recommend doing a backup of the files we are going to edit, so in case something goes wrong, which I don’t think it will happen, we can restore our site =) Also, if you are on Windows, I recommend using  Notepad++ Editor to edit PHP files. I use gedit in my Ubuntu computer. Works for v2.0.

Difficulty level: Easy-Medium

1. Browse the directory where Clip-Bucket is located.

2. Go to ./includes/classes/*

3. Open ClipBucket.class.php in your favorite PHP editor.

4. Search for: “function head_menu”.

Here you are with the function that renders each tab in the nav menu. Every $this-> you see inside this function corresponds to each tab. So for example, the first one corresponds to the tab ‘Home’; the second, to ‘Videos’; and so on.

5. The code for a new tab is:

$this->head_menu[] = array(‘name’=>”YOURTABNAME”,’link’=>”THEURL“,”this”=>”TABNAME“);

So lets say we want to add a new tab called: ‘Check this out!’ and when we click it, we want it to redirect us to the website: ‘http://www.theotherwebsite.tld’. The code we should use is:

$this->head_menu[] = array(‘name’=>”Check this out!”,’link’=>”http://www.theotherwebsite.tld”,”this”=>”checkthisout“);

6. Now you want to add it after the first tab (The home tab). You should place it this way:

$this->head_menu[] = array(‘name’=>lang(“menu_home”),’link’=>BASEURL,”this”=>”home”);
$this->head_menu[] = array(‘name’=>”Check this out”,’link’=>”http://www.theotherwebsite.tld”,”this”=>”checkthisout”);
$this->head_menu[] = array(‘name’=>lang(“videos”),’link’=>cblink(array(‘name’=>’videos’)),”this”=>”videos”);

And that’s all! You have now just learned how to add a new tab. I hope you liked it and found this post useful! Have fun with it, and if you got a question about this, do not hesitate to ask me =D

Best Regards,

Richi

Looking for quality Clip-Bucket hosting? Try out Arvixe and you won’t be disappointed.


28 Comments

  1. Reji   |  Friday, 04 February 2011 at 4:34 am

    hi Richi
    i try so many time i can’t do always error coming pls help

  2. Richi Glez   |  Saturday, 12 February 2011 at 10:12 am

    Hello Reji,

    Please tell me the error you’re getting as well as your CB version.

    Regards,
    Richi

  3. vps   |  Tuesday, 01 March 2011 at 8:02 am

    I must show my thanks to this writer for rescuing me from this type of challenge. Just after browsing through the the net and coming across things which are not beneficial, I figured my life was gone. Living without the presence of approaches to the difficulties you’ve solved through your short post is a critical case, and those that might have in a negative way damaged my career if I had not noticed your web page. Your actual capability and kindness in maneuvering almost everything was important. I don’t know what I would’ve done if I had not discovered such a step like this. I can also at this moment look forward to my future. Thank you very much for your skilled and sensible help. I won’t think twice to propose your web sites to any individual who desires support about this issue.

  4. Richi Glez   |  Thursday, 03 March 2011 at 4:29 pm

    Hey,

    Thank you so much for your kind words. I’m really glad that this helped you solve your problem, it makes me really happy that I helped someone =).

    If you would like to have a specific article written by me, please tell me, and I’ll do my best to add it.

    Warm Regards,
    Richi

  5. Jeevanjot Singh   |  Tuesday, 22 March 2011 at 1:53 am

    Thanks alot!! It saved me so much of time. It was a great help you have done!

  6. snatch   |  Friday, 08 July 2011 at 7:40 am

    thx a lot for all your tips…. very very useful :)

    just a little little error in your example :
    $this->head_menu[] = array(‘name’=>”Check this out!”),’link’=>”http://www.theotherwebsite.tld”,”this”=>”checkthisout“);

    You have to delete “)” after the first “Check this out!” :)
    good one :
    $this->head_menu[] = array(‘name’=>”Check this out!”,’link’=>”http://www.theotherwebsite.tld”,”this”=>”checkthisout“);

    I use it on my website and it works fine, thanks a lot again ! very good job !

    Another question : You know where i can change the width of each array of the menu ? because, now, the bar menu is on two rows :p ?

  7. Richi Glez   |  Saturday, 09 July 2011 at 1:14 pm

    Hello,

    Thank you very much for the correction, I have just edited the article :)

    About the array, you have to edit the CSS class that handles the navigation bar to make it smaller. Go to ./styles/{YOURTEMPLATE}/theme/main.css, the class is called .top_tabs, if you need an article to be written about this, let me know.

    Best Regards,
    Richi

  8. Kowasky   |  Wednesday, 13 July 2011 at 3:04 pm

    Hello

    Are you sure that this work also for the latest cb 2.51?
    I Tryed to insert that line but nothing appear, remains the defoult menu tabs…

    Bad me when I upgraded to the latest cb version, the 2.09 was working much better than this…

    Sorry for my bad english
    Roby

  9. Richi Glez   |  Thursday, 14 July 2011 at 10:52 am

    Hello Kowasky,

    This articles was written for v2.0.91, I’ll write a new one for the new v2.5.

    I’ll still prefer v2.0.91 until they correct all the bugs..

    Regards,
    Richi

  10. Kowasky   |  Thursday, 14 July 2011 at 12:33 pm

    Hi Richi

    This is a good news for me, Ill be tuned with this topic
    thx
    :)

    Ciao
    Roby

  11. Richi Glez   |  Sunday, 31 July 2011 at 5:44 pm

    Hello Kowasky,

    Today I went and checked v2.5.1 and I found out it’s the same way in that version too, what are the errors you are having?

    Best Regards,
    Richi

  12. [HOW-TO] Add new item in Clip-Bucket's footer | Arvixe Blog   |  Sunday, 31 July 2011 at 5:58 pm

    [...] you how to insert a new item in the footer. It’s basically the same as in my previous post: http://blog.arvixe.com/add-new-tab-in-navigation-menu . Written for v2.0.91 and [...]

  13. MikeB   |  Monday, 22 August 2011 at 3:10 pm

    The code should read:

    $this->head_menu[] = array(‘name’=>lang(“TAB NAME”),’link’=>”WEB URL”,”this”=>”home”);

    All you need do is change TAB NAME and WEB URL.

    I fought with your original code post for 2 days before I got it to work this way.

  14. Richi Glez   |  Friday, 26 August 2011 at 8:24 pm

    Hello,

    Your code is basically the same as mine, both would do the job. The only “big” difference, is the last item of the array, where you have “home”. Leaving home, would apply all JS code that is specially assigned to the homepage, while having a different value, you would be able to assign certain JS code to only that page.

    Regards,
    Richi

  15. John   |  Monday, 05 December 2011 at 9:12 pm

    This is not working for the latest version 2.6. i would like to add a paypal donate button or use existing default button.

  16. Richi González   |  Monday, 05 December 2011 at 10:10 pm

    Hello,

    Try what MikeB said: $this->head_menu[] = array(‘name’=>lang(“TAB NAME”),’link’=>”WEB URL”,”this”=>”home”);

    Regards,
    Richi

  17. Ugi   |  Tuesday, 27 December 2011 at 5:45 pm

    pls i have followed ur procedures, but the new tab inherits the propertise of the old example this”=>”home”

    I want to insert Services
    $this->head_menu[] = array(‘name’=>lang(“Services”),’link’=>”services.php”,”this”=>”home”);

    when the services.php link is clicked, the home page is also highlighted . both pages home and services are highlighted with the same colour as if the user is on both page at the same time……..

    pls how can i make the code this and have services appear on my menu
    $this->head_menu[] = array(‘name’=>lang(“TAB NAME”),’link’=>”services.php”,”this”=>”services”);

  18. Richi González   |  Tuesday, 27 December 2011 at 6:07 pm

    Hello,

    Use: $this->head_menu[] = array(‘name’=>lang(“Services”),’link’=>”services.php”,”this”=>”services”);

    On services.php, add at the top: define("THIS_PAGE",'services');

    Anything else, let me know.

    Regards,
    Richi

  19. Ugi   |  Tuesday, 27 December 2011 at 10:17 pm

    ok thanks, but after doing this, the Services Link disappears from the menu, cant see it at all

  20. Ugi   |  Tuesday, 27 December 2011 at 11:48 pm

    What do I do to make it appear as a menu option? cos i cant see it at all

  21. Ugi   |  Tuesday, 27 December 2011 at 11:52 pm

    when I replace ”this”=>”home”, it appears, but when I use ”this”=>”services”, it disappears

  22. 1dell   |  Saturday, 07 January 2012 at 1:23 pm

    I’ve tried both methods. I’m running CB 2.6 I guess the script is different because this is the error I’m getting:

    Parse error: syntax error, unexpected ‘:’, expecting ‘)’ in /home/*****/public_html/includes/classes/ClipBucket.class.php on line 508

  23. Mario   |  Thursday, 19 January 2012 at 8:48 pm

    I’ve tried them both as well, I’m getting the same error sent. Ive all so copy and pasted the default codes (the ones use for the other tabs) just replaced the names with a new name. It just load the site as if nothing was edited. Does the newest CB2.6 have a menu for the NAVI bar ?? cause I’ve noticed it has one called MANAGE PAGE for putting them in the footer.

    THX

  24. Saeed Ahmad   |  Saturday, 15 September 2012 at 5:10 am

    I want to add the hidden web static counter , Where to make / add script ?

  25. Richi González   |  Tuesday, 09 October 2012 at 8:43 am

    Hello,

    In ./styles/layout/footer.html, make sure that you wrap the code inside {smarty}..code..{/smarty} tags if it contains Javascript.

    Anything else, let me know.

    Regards,
    Richi

  26. jaime De Aguiar   |  Monday, 12 November 2012 at 10:55 am

    Hi Richie,

    Will the code to create a new tab work on the latest ClipBucket version ?

  27. Richi González   |  Monday, 12 November 2012 at 8:37 pm

    It is supposed to. If for any reason it doesn’t, please go to the forum (forum.arvixe.com) and start a new thread so I can personally assist you.

    Regards,
    Richi

  28. ahmad balavipour   |  Monday, 08 April 2013 at 1:27 am

    Thanks alot, very good tutorial

Leave a Reply






three + = 12