PDA

View Full Version : Adjusting breadcrumbs to show root URL


bill
02-24-2006, 01:14 AM
I have vbDrupal set as the root of my site. I would like to set the breadcrumbs in the navbar to reflect this structure both in vbDrupal and vB. For example in vB, the header of this thread shows:

Forums > Support > Templates and Themes
Adjusting breadcrumbs to show root URL

I would like it to show this:

MYvbDrupal Homepage > Forums > Support > Templates and Themes
Adjusting breadcrumbs to show root URL

Then, in vbDrupal I would like to imitate this pattern. Currently it shows this:

Forums
MYvbDrupal Homepage

or

Forums > MYvbDrupal Homepage
MYvbDrupal topic

I want to setup something like this:

MYvbDrupal Homepage > MYvbDrupal topic

or

MYvbDrupal Homepage
MYvbDrupal topic

elmuerte
02-24-2006, 09:56 AM
I have that on my site. (see attachment)

Here are my modified templates:

drupal_header (only the breadcrumb part)

<!-- breadcrumb, login, pm info -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="alt1" width="100%">
<if condition="is_array($navbits)">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="bottom">
<td><a href="$vboptions[drupalurl]/$session[sessionurl_q]" onclick="history.back(1); return false;"><img src="$vboptions[bburl]/$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td>
<td>&nbsp;</td>
<td width="100%"><span class="navbar"><a href="$vboptions[drupalurl]/$session[sessionurl_q]" accesskey="1">$vboptions[hometitle]</a></span> $navbits[breadcrumb]</td>
</tr>
<tr>
<td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><a href="$scriptpath"><img class="inlineimg" src="$vboptions[bburl]/$stylevar[imgdir_misc]/navbits_finallink.gif" alt="$vbphrase[reload_this_page]" border="0" /></a> <strong>$navbits[lastelement]</strong></td>
</tr>
</table>
<else />
<div class="navbar" style="font-size:10pt"><a href="$vboptions[drupalurl]/$session[sessionurl_q]" accesskey="1"><img class="inlineimg" src="$vboptions[bburl]/$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions[hometitle]</strong></div>
</if>
</td>

<if condition="$bbuserinfo['userid']">

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
<phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
<if condition="$show['pmstats']"><br /><a href="$vboptions[bburl]/private.php$session[sessionurl_q]"><phrase>$vbphrase[private_messages]</phrase></a>: <phrase>$vbphrase[unread_x_nav_compiled]</phrase>, <phrase>$vbphrase[total_x_nav_compiled]</phrase>.</if>
</div>
</td>

<else />

<td class="alt2" nowrap="nowrap" style="padding:0px">
<!-- login form -->
<form action="$vboptions[drupalurl]/index.php?q=user/login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
<script type="text/javascript" src="$vboptions[bburl]/clientscript/vbulletin_md5.js"></script>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td class="smallfont">$vbphrase[username]</td>
<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
</tr>
<tr>
<td class="smallfont">$vbphrase[password]</td>
<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" size="10" accesskey="p" tabindex="102" /></td>
<td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
</tr>
</table>
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
</form>
<!-- / login form -->
</td>

</if>

</tr>
</table>
<!-- / breadcrumb, login, pm info -->


navbar (only the breadcrumb part)

<!-- breadcrumb, login, pm info -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="alt1" width="100%">
<if condition="is_array($navbits)">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="bottom">
<td><a href="#" onclick="history.back(1); return false;"><img src="$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td>
<td>&nbsp;</td>
<td width="100%"><span class="navbar"><a href="$vboptions[homeurl]$session[sessionurl_q]" accesskey="1">$vboptions[hometitle]</a></span> <span class="navbar">&gt; <a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1">$vbphrase[forums]</a></span> $navbits[breadcrumb]</td>
</tr>
<tr>
<td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><a href="$scriptpath"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink.gif" alt="$vbphrase[reload_this_page]" border="0" /></a> <strong>$navbits[lastelement]</strong></td>
</tr>
</table>
<else />
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="bottom">
<td><a href="#" onclick="history.back(1); return false;"><img src="$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td>
<td>&nbsp;</td>
<td width="100%"><span class="navbar"><a href="$vboptions[homeurl]$session[sessionurl_q]" accesskey="1">$vboptions[hometitle]</a></span>
</tr>
<tr>
<td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><a href="$scriptpath"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink.gif" alt="$vbphrase[reload_this_page]" border="0" /></a> <strong>$vbphrase[forums]</strong></td>
</tr>
</table>
</if>
</td>

<if condition="$show['member']">

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
<phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
<if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl_q]">$vbphrase[private_messages_nav]</phrase></if>
</div>
</td>

<else />

<td class="alt2" nowrap="nowrap" style="padding:0px">

<!-- login form -->
<form action="login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<tr>
<td class="smallfont">$vbphrase[username]</td>
<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
</tr>
<tr>
<td class="smallfont">$vbphrase[password]</td>
<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" size="10" accesskey="p" tabindex="102" /></td>
<td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
</tr>
</table>
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
</form>
<!-- / login form -->

</td>

</if>

</tr>
</table>
<!-- / breadcrumb, login, pm info -->

bill
02-27-2006, 08:43 PM
This works beautifully on my vB forums templates, but the vbDrupal breadcrumbs are still a bit off. I replaced the breadcrumb part of my drupal_header with the one you gave above and now I'm getting duplicate listing on the main vbDrupal page:

MYvbDrupal Homepage
|--MYvbDrupal Homepage

Then, with my Drupal categories/nodes I am not getting a proper breadcrumb. It looks this:

MYvbDrupal Homepage > MYvbDrupal Homepage
|--Category/Node/Taxonomy

The breadcrumb produced by Drupal is fine. It's just the vbDrupal header breadcrumb I'm still stuck with. I really haven't done much customization of this style at all other than to change a few colors. My only changes to the code have been for vbDrupal customizations. Do I need to change other settings or templates?

elmuerte
02-28-2006, 12:16 AM
oh right, I also modified the .theme file to fix the breadcrumb:

in theme_page

$navbits = array();
$durls = drupal_get_breadcrumb();
array_shift($durls); //shift home
foreach ($durls as $durl)
{
if (preg_match("#<a.*href=\"(.*)\".*>(.*)</a>#iU", $durl, $matches))
{
$navbits[$matches[1]] = $matches[2];
}
//$navbits[$durl["path"]] = $durl["title"];
}
$navbits['-'] = $title;
$navbits = construct_navbits($navbits);


instead of


$navbits = array($vboptions['drupalurl'] . '/?' . $sessionurl => $vboptions['drupalname']);
if ($title != '') $navbits[''] = $title;
$navbits = construct_navbits($navbits);

bill
02-28-2006, 03:17 AM
Sorry, I'm a bit lost here. I can find mentions of the theme_page function in the drupal/includes/theme.inc file, but not the lines of code you are replacing. I can't find references to this function in any of the *.theme files either. Where can I find theme_page?

elmuerte
02-28-2006, 10:16 AM
It's how drupals theming (and module) stuff works. The base name consists out of the name of the theme (or module) appened with the "general" function.

So in case of "mytheme.theme" the function
theme_page()
will be named:
mytheme_page()



Hmm... looks like the code tags in the forum are a bit broken

bill
02-28-2006, 11:37 PM
That did the trick. Thanks for the explanations. I'm a bit new to Drupal. ;)

Hmm... looks like the code tags in the forum are a bit brokenI was wondering about that myself. Tried it in IE, FireFox, and Opera and it's equally messed up in all of them. ;)

bill
08-29-2006, 02:04 AM
I was doing an upgrade to vB 3.6 and vbDrupal 4.7 on a test version of my site. I noticed several areas of the vB template for navbar had changed. Should I incorporate any of the vB 3.6 changes in the <!-- breadcrumb, login, pm info --> area? What about the drupal_header?

elmuerte
08-29-2006, 12:15 PM
If you are using the defaultvb theme you'll have to fix a lot of stuff for it's templates. The people at Jelsoft made quite some changes to certain templates that were hardcoded in the defaultvb templates.

bill
08-29-2006, 07:53 PM
So the alterations to the breadcrumb areas of the template code above are no longer recommended with vB 3.6 and vbDrupal 4.7 for the defaultvb theme? That's what I'm planning to use.

A lot of the changes there appear to be for the login and pm info. However, the biggest changes look to be in the breadcrumb area. I'm uncertain what needs to be changed there.

Anyone successfully changed these templates in this manner?

Brent H
11-07-2006, 07:44 PM
Any way to achieve this now?

smashingyoungman
11-25-2006, 02:58 PM
For myself, I just removed the navbar on all non-vB pages using an <if> statement. I designed my theme with the navbits alone in their own table, separate from the links and PM box...I hate the default vBulletin navbar.

bill
12-05-2006, 04:39 AM
Has anyone tried to do this with the defaultangy theme?

Caerydd
12-13-2006, 04:58 PM
Not yet, would like some word on it though?

Angelone
12-14-2006, 11:19 AM
For myself, I just removed the navbar on all non-vB pages using an <if> statement. I designed my theme with the navbits alone in their own table, separate from the links and PM box...I hate the default vBulletin navbar.


Can you show us your code to do that?

Thank you!

smashingyoungman
12-24-2006, 01:09 PM
Can you show us your code to do that?

Thank you!

This might not be an optimal solution for those using the standard navbar, though you could use the code to remove the navbits only, and not the entire navbar. It would look something like this with the default navbar template:

<if condition="THIS_SCRIPT == index OR THIS_SCRIPT == forumdisplay OR THIS_SCRIPT == showthread OR THIS_SCRIPT == newthread OR THIS_SCRIPT == usercp OR THIS_SCRIPT == online OR THIS_SCRIPT == profile OR THIS_SCRIPT == private OR THIS_SCRIPT == subscription OR THIS_SCRIPT == moderation OR THIS_SCRIPT == calendar OR THIS_SCRIPT == newreply OR THIS_SCRIPT == faq OR THIS_SCRIPT == memberlist OR THIS_SCRIPT == search OR THIS_SCRIPT == showgroups OR THIS_SCRIPT == member">

<td class="alt1" width="100%">
<if condition="is_array($navbits)">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="bottom">
<td><a href="#" onClick="history.back(1); return false;"><img src="$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td>
<td>&nbsp;</td>
<td width="100%"><span class="navbar"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1">$vboptions[bbtitle]</a></span> $navbits[breadcrumb]</td>
</tr>
<tr>
<td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><if condition="$_SERVER['REQUEST_METHOD'] == 'POST'"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink.gif" alt="" border="0" /><else /><a href="$scriptpath"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink.gif" alt="$vbphrase[reload_this_page]" border="0" /></a></if> <strong>$navbits[lastelement]</strong></td>
</tr>
</table>
<else />
<div class="navbar" style="font-size:10pt"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_start.gif" alt="" border="0" /></a> <strong>$vboptions[bbtitle]</strong></div>
</if>
</td>
</if>

I would actually prefer to leave the navbits intact, if only I could get them to display in a way that properly reflects the structure of my site.