[HOW-TO] Add new tab in Clip-Bucket’s navigation menu
Written by Richi González Wednesday, 29 December 2010
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