View Full Version : How to add something to main menu?
echopulse
12-09-2005, 08:58 PM
I've looked in header.tpl, and the smarty files, and I cannot find anywhere to edit the main site menu at the top. What I want to do, is to add Suggest Link to the main menu. And I want it to add a link to root.
hi echopulse.
do you mean the menu "
* Home
* Search
* New Links
* Top Links
* Popular Links
"
??
Suggest Link appears there when it's usefull. Home links to root.
Or do you mean another menu?
Greetings,
gb
echopulse
12-09-2005, 09:46 PM
That's the menu I'm referring to. I want to add suggest link to the end. I can figure it out, if I can figure out which template it is in. What I meant about adding a link to root, is that I want it to suggest a category to the ROOT category.
I don't get your point. The option Suggest link only works in cateogries, not in Root and not in top/popular/ etc.
On the pages where suggest link works or makes sense it is there anyway.
Anyway, if you want to change something:
The menu is called in the header.tpl by {$menu}
It is generated by a function in layout.php around line 175
find: function print_menu($aCategory = 0)
let me know if you need help.
greetings,
gb
echopulse
12-09-2005, 09:52 PM
I don't want to suggest a link, I want to suggest another category. I'm gonna look through layout.php and see what I can find.
echopulse
12-09-2005, 09:59 PM
Thanks. I moved some code around, and I was able to get Suggest Category to work in Root. If anyone else wants this, here is the code.
Replace this:
$menu['popular-links']['caption'] = $gDirLang['popular_links'];
$menu['popular-links']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}popul ar-links.html";
with this:
$menu['popular-links']['caption'] = $gDirLang['popular_links'];
$menu['popular-links']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}popul ar-links.html";
$menu['suggest-category']['caption'] = $gDirLang['suggest_category'];
$menu['suggest-category']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}sugge st-category.php?id={$aCategory}";
hmm, haven't you wrote about suggest link before...
anyway, if you change this and do not change anything a little below here:
if ($aCategory)
{
$menu['suggest-link']['caption'] = $gDirLang['suggest_link'];
$menu['suggest-link']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}sugge st-link.php?id={$aCategory}";
$menu['suggest-category']['caption'] = $gDirLang['suggest_category'];
$menu['suggest-category']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}sugge st-category.php?id={$aCategory}";
}
You will have "Suggest Category" twice in all categories except root.
So code above should change to
if ($aCategory)
{
$menu['suggest-link']['caption'] = $gDirLang['suggest_link'];
$menu['suggest-link']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}sugge st-link.php?id={$aCategory}";
}
Good night,
gb
echopulse
12-09-2005, 10:34 PM
It would seem so, but there is something in there that prevents it from appearing twice. Check my directory if you don't believe me.
http://www.conservativeportal.com
Simon Gooffin
12-10-2005, 05:40 AM
hi guys,
of course there is something, it's array key index. your both menu items have 'suggest-category' key and it should be unique for the array element otherwise it just rewrites it. So if you even have
$menu['suggest-category']['caption'] = $gDirLang['suggest_category'];
$menu['suggest-category']['url'] = "{$gDirConfig['base']}{$gDirConfig['dir']}sugge st-category.php?id={$aCategory}";
5 or 10 times in the code it will be displayed just once
P.S. let me know, echopulse, if you do not mind of listing your directory on our portfolio page
i see simon, thanks for clarifying...
Simon Gooffin
12-10-2005, 09:17 AM
you are welcome :)
echopulse
12-10-2005, 02:33 PM
Sure Simon, you can put it in the Portfolio now. I sent you a PM. Didn't you get it?
Simon Gooffin
12-13-2005, 07:22 AM
it's there :) take a look
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.