PDA

View Full Version : Any way to get "correct" breadcrumb when using page=xxx


Tom M
01-02-2005, 09:04 PM
I'm working on a multi-page add-on using the page=xxx syntax. The module is working but it really is a drill down scenario so it would be nice to be able to have the breadcrumb reflect that. The only other solution seems to be to manually add links that backtrack where the user came from.

I've seen several other posts related to the subject but didn't run across any definitive answer.

Tom M
01-03-2005, 04:06 PM
btt - anybody?

Our Sponsors
 

Brian
01-03-2005, 04:11 PM
Sorry, but I don't think I understand exactly what you're asking... Can you maybe post a link and/or some more info?

Tom M
01-03-2005, 05:11 PM
As one navigates through the page structure it would be nice to have the depth reflected in the breadcrumb.

| The Babblers > Recommendations
+- Categories

| The Babblers > Recommendations > Categories
+- Accessories

| The Babblers > Recommendations > Categories > Accessories
+- (Vendor Name)

This would provide the traceback navigation w/o having to do so on a separate line. It also provides a much cleaner integrated look.

Try http://www.babblers.org/index.php?page=recommend to see what I mean. The existing breadcrumb stays stuck at the page title when drilling down by following the links.

Our Sponsors
 

Brian
01-03-2005, 05:59 PM
I assume that's a PHP page that's pulling that info? If so, have you tried constructing the navbar in that file?

Tom M
01-03-2005, 06:17 PM
It is a PHP module that using the CMPS system.

This may be a dumb question but...

If the navbar is being built by CMPS then how can I build it?

OTOH - If I can turn the CMPS navbar off for just that page then I can easily add the navbar template to my list and do the tweeking.

Brian
01-03-2005, 06:30 PM
if ($vba_options['portal_shownavbar'] AND empty($navbar))
{
if ($pages['name'] != 'home')
{
$navbits[''] = $pages['title'];
}
$navbar = construct_adv_navbar($navbits);
}


The navbar should only be built if $navbar isn't already definded somewhere else first.

Tom M
01-03-2005, 11:43 PM
Thanks. It's now all sorted out.

Tom M
02-02-2005, 05:15 PM
New problem. Same topic.

The breadcrumb stuff now works fine however none of the links are getting fixed up when using this method. I guess I overlooked that originally. Here's the code sequence I'm using...
// fix up the breadcrumb information
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_recommend') . '";');
I'm out of ideas at the moment :(

Brian
02-02-2005, 06:18 PM
What exactly do you mean by "fixed up"?

Tom M
02-02-2005, 06:25 PM
"fix up" means displaying my own breadcrumb for a more accurate traceback history when using the "page=xxx" scenario. You can see it in action on my site by going to this recommendations page (http://www.babblers.org/index.php?page=recommend&do=reviews&id=64) and looking at the breadcrumb.

The problem is is none of the navbar links point to the right place. I think this used to work OK before I upgraded to 1.0.1 as there used to be a construct_navbar() function call that was used.

Brian
02-03-2005, 10:00 AM
What exactly is wrong on that page? The links and breadcrumb appeared fine to me, so I must be missing something.

Tom M
02-03-2005, 01:27 PM
You must have caught it when I was experimenting :o.

The only way I get it to work is to copy the entire section of code from vba_cmps_include_bottom.php that deals with the navbar. This works...
// begin - fix up the breadcrumb information and build navbar links
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

$navreplacearray = explode("\r\n", $vba_options['global_navbar_replace']);

$navreplace['find'] = array(
'"clientscript',
'"private.php',
'\'misc.php',
'>$vboptions[bbtitle]',
'"$vboptions[forumhome].php'
);

$navreplace['replace'] = array(
'"' . $vboptions['bburl'] . '/clientscript',
'"' . $vboptions['bburl'] . '/private.php',
'\'' . $vboptions['bburl'] . '/misc.php',
'>$vboptions[hometitle]',
'"$vboptions[homeurl]'
);

$navreplace = construct_replacement_array($navreplacearray, $navreplace);

$navbar = str_replace($navreplace['find'], $navreplace['replace'], $navbar);
// end - fix up the breadcrumb information and build navbar links

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_recommend') . '";');

While just this doesn't
// begin - fix up the breadcrumb information and build navbar links
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
// end - fix up the breadcrumb information and build navbar links

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_recommend') . '";');

Version 1.0.0 of CMPS had a call for constructing the navbar that has apparently been changed to inline code. My guess is that the link adjustments are made at an earlier point in time now so that building one's own navbar doesn't work the same way.

I also tried just defining $navbits but that doesn't do it either as the test is to see if $navbar is empty or not.

Tom M
02-03-2005, 01:42 PM
OK, I got it fixed in 1.0.1

It seems that it is necessary to move 2 sections of code to before the active module processing. All the code dealing with $headinclude & $navbar needs to be moved to before the active module processing is done. Once that's been moved then everything works as expected.

In other words, I have the processing of templates, etc. now being done in the order they appear on the displayed page. Sort of makes sense I guess though in most cases it doesn't matter.

Perhaps it would be possible for this to be changed in th next release if there's no downside to it.