News:

Wondering if this will always be free?  See why free is better.

Main Menu

[Beta 4] Missing Breadcrumbs?

Started by Deprecated, October 03, 2008, 07:07:34 PM

Previous topic - Next topic

Deprecated

What are breadcrumbs?

In Display.index.php:
    // Show breadcrumbs at the bottom too?
    echo '
    <div class="marginbottom">', theme_linktree(), '</div>';


The breadcrumbs are the linktrees previously shown at the bottom of the board index pages and at the bottom of the topic pages. They were there in Beta 3.1 and they disappeared in Beta 4.

The linktrees come from index.template.php:
// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree($force_show = false)
{
    global $context, $settings, $options, $shown_linktree;

    // If linktree is empty, just return - also allow an override.
    if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
        return;

    //!!! Temporarily don't do it twice.
    if (!empty($shown_linktree))
        return;
    $shown_linktree = true;

    echo '
    <ul id="linktree">';

    // Each tree item has a URL and name. Some may have extra_before and extra_after.
    foreach ($context['linktree'] as $link_num => $tree)
    {
        echo '
...
...


Notice the famous last words, "Temporarily don't do it twice." I presume that's a comment to remind the code author to fix it before the release, or maybe not.

The problem is that where theme_linktree() gets called changed in Beta 4 and it appears to me that some of the stuff got moved over to different templates and some didn't. The code above looks like a temporary fix to solve some other problems caused by the calls to theme_linktree() being moved. If you take out that "temporary" code you get double linktrees above Search and a few other pages.

Well I just kluged it some more and added another argument, "$extreme_prejudice" that forces it to display at the bottom of the page even if it already got displayed at the top of the page:

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree($force_show = false, $extreme_prejudice = false)
{
     global $context, $settings, $options, $shown_linktree;

     // If linktree is empty, just return - also allow an override.
     if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
         return;

     //!!! Temporarily don't do it twice.
     if (!empty($shown_linktree) && !$extreme_prejudice)
         return;
     $shown_linktree = true;

     echo '
     <ul id="linktree">';


The $extreme_prejudice = true forces the "don't do it twice" check to be ignored and so the link tree appears. Then in Display.template.php and MessageIndex.template.php I use the call theme_linktree(true, true) to force the second link tree to show up.


There is only one problem with this fix. You end up with two <ul id="linktree"> statements on the same page, and you can't repeat the same ID name because the page won't pass validation. You can have only one instance of any ID. So change it, right? I changed the second one to <ul id="linktree2"> and it lost the formatting, like the display:inline property that keeps the elements all on the same line.

I looked high and low trying to figure out the CSS sense behind why the first linktree gets the proper formatting and the second one doesn't, and I can't even figure out how the first one gets its formatting. I must be overlooking something stupid.

Well I'm tossing this out for the night crew. I've had enough fun this afternoon. :)

I've wrapped my code in a mod package and attached it to this post. As it stands it fixes the missing breadcrumbs just fine, but the problem is that it won't validate. The correct solution would fix the missing breadcrumbs without violating validation.

Anybody wanting to fix this problem who doesn't mind the inability to validate the code can use it as-is.

[An obsolete download was removed from this post.]

SpectroPro

Works like a dream!!!!  Thank you!!!!!!
Stats:  SMF v. 2b4  -  Mambo v4.65  -  Bridge v2.0b1

http://www.therealityrocks.com    http://forum.therealityrocks.com/trr
- Greg

Deprecated

Well you're welcome Greg. (From another Greg.)

Thing is, it won't pass W3C validation. :(

rlsteelman

We are getting the double bread crumb issue.  Anyone found a fix for this yet? 

Deprecated

I have a fix for the whole linktree problem. Unfortunately it is half finished. I intend to post something on this subject in the next 2-7 days.

X3mE

Quote from: Deprecated on October 08, 2008, 10:58:08 PM
I have a fix for the whole linktree problem. Unfortunately it is half finished. I intend to post something on this subject in the next 2-7 days.

We're still waiting :)
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



Deprecated

Ah yeah, I got carried away and started fixing ALL the linktrees. It's like pulling off the top of a can of worms.

Actually I can fix the linktree almost immediately. Already did the part you want. I'll try to get it out tomorrow. And fix my broken forum. And support SMF. And write more mod packages. And get on SMF IRC. And make some content for my hobbyist forum. And get my dog trimmed and washed and vaccinated. And clean my kitchen and do the laundry.

You see a pattern here? :) Please feel free to PM me Saturday and remind me if I haven't done anything about the missing breadcrumbs.

My mod fixes about 12 template files to get the crumbs back. (only a couple lines each) I was just fixing the admin center and mod center. Woah, what a can of worms!!! :)

Paracelsus

Quote from: Deprecated on October 16, 2008, 11:42:27 PM
Ah yeah, I got carried away and started fixing ALL the linktrees. It's like pulling off the top of a can of worms.

Actually I can fix the linktree almost immediately. Already did the part you want. I'll try to get it out tomorrow. And fix my broken forum. And support SMF. And write more mod packages. And get on SMF IRC. And make some content for my hobbyist forum. And get my dog trimmed and washed and vaccinated. And clean my kitchen and do the laundry.

You see a pattern here? :) Please feel free to PM me Saturday and remind me if I haven't done anything about the missing breadcrumbs.

My mod fixes about 12 template files to get the crumbs back. (only a couple lines each) I was just fixing the admin center and mod center. Woah, what a can of worms!!! :)

Dude, read "Getting Things Done" from David Allen. ;)

Deprecated

My main problem is that I've got a pound of wanna and only a few ounces of hereya.

I just have to bust off the breadcrumb fix from my don Quixote wish to fix the linktree problem globally. I'll try and get on it today subject to my fixing a major bug on my biggest forum. I think I may just merge it with my Help Linktree Fix (mod package) and change the name. Being an upgrade to an existing mod it won't have to go through the approval process so it can be available immediately.

Actually I was going to bust it out anyway. The bigger fix modifies so many files that it will need separate update scripts for each file. Or otherwise it could set the record for longest mod script, and I surely don't want to do that. :P

Deprecated

Okay I found the missing breadcrumbs, and I've put them in a mod package. I'm doing the final testing tonight and early tomorrow morning. Actually it's all working now but I would rather release them after I've had a few cups of very black coffee, and checked them over one final time.

I have decided to fold the update into my Help Linktree Fix mod package so that the package can be released immediately as an update rather than as a new mod package. Look for it tomorrow in the Help Linktree Fix support topic.

Ya want 'cher bread crumbs I got 'em tomorrow!!! For internationals that will be about 12 hours from time of my post. :)

Deprecated

Please be advised that I have now completed the "missing breadcrumbs" fix. And I only had to modify 13 files! :P

You can find your missing breadcrumbs here: Help Linktree & Missing Breadcrumbs Fix

Please direct any questions or comments to the modification's support topic.

Deprecated

Just a comment on what happened to Beta 4:

One of SMF's developers wisely realized that instead of every template calling theme_linktree() separately to put the linktree at the top of the page (below the menu buttons) it would be better to have it appear only once in index.template.php. Then not only will it appear uniformly across all SMF pages, but themes who want to modify the linktrees will be able to do so by changing just one line in one file rather a dozen files like at present.

Unfortunately the developer must have been in a rush so instead of fixing the other dozen files he just put a workaround in the function theme_linktree(). This workaround kluge caused double top linktrees in many pages so it keeps track of how many linktrees have been generated for the page, and refuses to add any after the first top of the page linktree. The end result was that any bottom of the page "breadcrumbs" disappeared.

I went ahead and edited the dozen or so files for the developers, and took out the kluge. You're welcome! :P

rlsteelman

When I used your previous work around at towards the top, not the mod but the actual hard code, my forums were getting these errors on every page: Use of undefined constant extreme_prejudice - assumed 'extreme_prejudice'

It was so bad that it showed up in the error logs 1 million+ times.  So does this mod correct that issues?

Deprecated

#13
I forgot this topic was still going. The initial fix in the OP was still a patch on a patch. Since then I have updated it and perfected it. You can download the corrected fix at the Mod Site:

Help Linktree & Missing Breadcrumbs Fix

The "extreme prejudice" was to deal with the developer's kluge. My modification removes the kluge so there is no more need for extreme prejudice. :)


Atheo

#14
Why was this download removed? The problem still exists and I can not find the solution. This mod is not a fix for missing breadcrumb links on pages other than help.

Advertisement: