Quote:
Originally Posted by XManuX
I wanted to give a bigger emphasis on the gallery, thus displaying the link in the main navbar, not in the "forum" sub-bar.
Here are the modifications in the navbar template :
Find:
Code:
{vb:raw template_hook.navtab_end}
Add Below:
Code:
<vb:if condition="!$vboptions['selectednavtab'] AND (THIS_SCRIPT == 'albumall' OR THIS_SCRIPT == 'album' OR THIS_SCRIPT == 'picall')">
<vb:if condition="$show['member']">
<li class="selected"><a class="navtab" href="albumall.php?{vb:raw session.sessionurl}">Gallery</a>
<ul class="floatcontainer">
<li><a href="picall.php?{vb:raw session.sessionurl}">Picture Gallery</a></li>
<li><a href="albumall.php?{vb:raw session.sessionurl}">Album Gallery</a></li>
<li><a href="album.php?{vb:raw session.sessionurl}do=latest">Latest Albums</a></li>
<li><a href="album.php?{vb:raw session.sessionurl}u={vb:raw userinfo.userid}">My Albums</a></li>
<li><a href="album.php?{vb:raw session.sessionurl}do=addalbum">Add Albums</a></li>
</ul>
<vb:else />
<li class="selected"><a class="navtab" href="albumall.php?{vb:raw session.sessionurl}">Gallery</a>
<ul class="floatcontainer">
<li><a href="picall.php?{vb:raw session.sessionurl}">Picture Gallery</a></li>
<li><a href="albumall.php?{vb:raw session.sessionurl}">Album Gallery</a></li>
<li><a href="album.php?{vb:raw session.sessionurl}do=latest">Latest Albums</a></li>
</ul>
</vb:if>
<vb:else />
<li><a class="navtab" href="albumall.php?{vb:raw session.sessionurl}" >Gallery</a>
</vb:if>
Find:
Code:
<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
Replace With:
Code:
<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search' AND THIS_SCRIPT != 'albumall' AND THIS_SCRIPT != 'album' AND THIS_SCRIPT != 'picall'">
Done.
Note: the addition in navbar could be easily coded as a hook on navtab_end, not sure that the replacment could be achieved in a "clean" way (ie : not altering the navbar template)
|
Thank for this! That filled in a couple of gaps for me. I tired using the product that created the links in the NavTab but I didn't like how the the tab wasn't selected when you were in an album. Your replacement works perfectly. Expect that since I'm not using the What's New button, mine looks like this:
PHP Code:
<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'albumall' AND THIS_SCRIPT != 'album' AND THIS_SCRIPT != 'picall'">
Anyone have any reasons for or against putting those in an array instead of using so many ANDs? I thought an array would be the way to go but both work I guess.
I also attempted to create a plugin to add the new tab and links. I did them in the same style as you where after you click on the main tab, the other links are in the secondary navigation bar and not in a drop-down. This is more consistent with the rest of the tabs.
Here's the plugin I created. I'm extremely new to this so be easy on me.
Hook: process_templates_complete
PHP Code:
$albumshowmember = '';
if ($show['member'])
{
$albumshowmember = ' <li><a href="album.php?' . $sess . '&u=' . $vbulletin->userinfo['userid'] . '">' . $vbphrase['my_albums'] . '</a></li>
<li><a href="album.php?' . $sess . '&do=addalbum">' . $vbphrase['add_album'] . '</a></li>
';
}
$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'albumall' OR THIS_SCRIPT == 'album' OR THIS_SCRIPT == 'picall')
{
global $vbphrase, $vbulletin;
$vbulletin->options['selectedalbum']='selectalbum';
$tabselected = ' class="selected"';
$sess = $vbulletin->session->vars['sessionurl_q'];
$tablinks = ' <ul class="floatcontainer">
<li><a href="albumall.php?' . $sess . '">' . $vbphrase['album_gallery'] . '</a></li>
<li><a href="picall.php?' . $sess . '">' . $vbphrase['picture_gallery'] . '</a></li>
<li><a href="album.php?' . $sess . '&do=latest">' . $vbphrase['latest_albums'] . '</a></li>
'.$albumshowmember.'';
}
$template_hook[navtab_end] .= '<li'.$tabselected.'><a class="navtab" href="albumall.php?' . $sess . '">' . $vbphrase['gallery'] . '</a>'.$tablinks.'</li>' ;
I created that using a lot of trial and error and copy and pasting using your code, the code provided in this mod, and Lynne's
[HOW TO - vB4] Create a New Tab in the navbar. I really don't know how clean or efficient it is, but seems to work so far!
Ok so as was typing all of the above, I discovered that KW802 accomplished everything I was going for in a nice product (just a few posts later) here:
https://vborg.vbsupport.ru/showthrea...20#post2199320. It does the same thing but uses a template for the code instead of having all of it in the plugin itself.
Oh well. I guess I just posted another way to do it. For you programmers, is it better to have the code in a template that gets cached or have it all in the plugin like what I did?
A huge thanks to HCGB for creating this and to everyone else who has supported it.