Breadcrumb Implementation

25 posts by 4 authors in: Forums > CMS Builder
Last Post: October 22, 2012   (RSS)

By northernpenguin - October 13, 2012

I would like to implement a breadcrumb trail on one of my client's websites. Every time I try, I get the whole menu printed instead of just the page I am on. Below is the menu code I am using:

<ul>
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>

<?php if ($categoryRecord['_isSelected']): ?>

<?php endif; ?>

<?php if ($categoryRecord['open_in_new_page'] == "1"): ?>
<b><a href="<?php echo $categoryRecord['url'] ?>" rel="self" target="_blank"><?php echo $categoryRecord['name'] ?></a></b>
<?php else: ?>
<a href="<?php echo $categoryRecord['url'] ?>" rel="self"><?php echo $categoryRecord['name'] ?></a>
<?php endif; ?>

<?php if ($categoryRecord['_isSelected']): ?>

<?php endif; ?>

<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach; ?>
</ul>


Any ideas?

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [greg] Breadcrumb Implementation

By northernpenguin - October 15, 2012

Greg: sorry, maybe I was not clear enough. The code I provided is what I am currently using to generate the menu, and it works great.

What I would like to do is use the menu titles in this section editor to generate the breadcrumb trail.

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Breadcrumb Implementation

By gregThomas - October 15, 2012

Hi,

Now I understand what the empty if statements are for!

Something like this should output the breadcrumbs for the selected category for you:

<?php if ($categoryRecord['_isSelected']): ?>
<p><?php echo $categoryRecord['breadcrumb'] ; ?></p>
<?php endif; ?>


Let me know if this isn't what your looking for.

Thanks.
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Breadcrumb Implementation

By northernpenguin - October 15, 2012 - edited: October 15, 2012

Nothing. Its blank and no errors are generated.

BTW, where does the field name "breadcrumb" come from? I don't use it anywhere in my code.

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Breadcrumb Implementation

By rconring - October 16, 2012 - edited: October 16, 2012

It is a system field in a "category" record along with lineage, parentNum, depth etc. (See attached jpg)
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987
Attachments:

breadcrumb.jpg 70K

Re: [rconring] Breadcrumb Implementation

By northernpenguin - October 16, 2012

Thanx Ron.

Now, I wonder why it doesn't print anything?
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [northernpenguin] Breadcrumb Implementation

By rconring - October 16, 2012

It's hard to say without seeing the code for the entire page. From my experience, when the breadcrumb does not display, it is because the category record has not been retrieved. Do any other variables in that record display?
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

Re: [northernpenguin] Breadcrumb Implementation

By gregThomas - October 16, 2012

Could you post all of the code you have so far from your page into a post for me? Also as Ron pointed out, I didn't check how you have your section organised in the CMS Builder! I assumed you are you using a Category menu section to create the navigation, or are you using a multi record section?

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Breadcrumb Implementation

By northernpenguin - October 16, 2012

Greg: Attached are 3 files. two are includes that define the menu (Category Menu) and the common php header. The 3rd file is the web page. If you search for "breadcrumb", you will find the code you provided.

Thanx

Ragi
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke