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

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 (2.6).

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”=>”home”);

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”=>”home”);

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”=>”home”);
$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.
Tags: , , , , , , , , , | Posted under ClipBucket | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I'm the Liaison between Arvixe and Clip-Bucket, so anything you need regarding Clip-Bucket or any particular computer-related subject you need, let me know so I can assist you.

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

  1. Reji says:

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

  2. Richi González Richi Glez says:

    Hello Reji,

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

    Regards,
    Richi

  3. vps says:

    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 González Richi Glez says:

    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. Thanks alot!! It saved me so much of time. It was a great help you have done!

  6. snatch says:

    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 González Richi Glez says:

    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 says:

    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 González Richi Glez says:

    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 says:

    Hi Richi

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

    Ciao
    Roby

  11. Richi González Richi Glez says:

    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. Pingback: [HOW-TO] Add new item in Clip-Bucket's footer | Arvixe Blog

  13. MikeB says:

    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.

    • Richi González Richi Glez says:

      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

  14. John says:

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

  15. Hello,

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

    Regards,
    Richi

  16. Ugi says:

    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”);

    • 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

  17. Ugi says:

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

  18. Ugi says:

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

  19. Ugi says:

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

  20. 1dell says:

    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

  21. Mario says:

    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

  22. Saeed Ahmad says:

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

    • 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

  23. Hi Richie,

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

  24. Thanks alot, very good tutorial

  25. Jimoh Adeleke says:

    I followed the procedure listed in http://blog.arvixe.com/add-new-tab-in-navigation-menu/

    But I am having the issue stated by Ugi in earlier trend, which is the new tab is being highlighted when home is selected when this=home. when I set this=newtab, newtab disappears.

    After a few troubleshooting, I noticed when creating new page per: http://docs.clip-bucket.com/how-to-add-new-page-in-clip-bucket, there is no parent_page defined in the newpage.php file. When I define parent_page in newtab.php, the actual page stops displaying

    I am thinking a solution to the problem may be how do you register a parent page? Then we can set this=newtab

  26. Sahil says:

    Please write article about clipbucket advertisement section. explain default placement of cb. which placement work with where?? I will be thankful for your quick reply. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *


7 × = 14

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>