Manipulating Breadcrumbs
3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 4, 2012 (RSS)
By Perchpole - July 4, 2012
Hello, All -
I'm trying to do some interesting things with breadcrumbs - using a piece of code I've often used before:
However, do the way in which I intend to use the code I need to remove some of the numbers from the breadcrumb range. For example, if the range was:
1:2:3:4
I need to delete number 3 - which would leave:
1:2:4
How can I do this?
:0/
Perch
I'm trying to do some interesting things with breadcrumbs - using a piece of code I've often used before:
$siblingLineage = preg_replace("/:\d+:$/", ":", $selectedCategory['breadcrumb']);
$siblings = array();
foreach ($categoryRecords as $category) {
if (preg_match("/^$siblingLineage\d+:$/", $category['breadcrumb']) && $category['num'] != $selectedCategory['num']) {
$siblings[] = $category;
}
}
However, do the way in which I intend to use the code I need to remove some of the numbers from the breadcrumb range. For example, if the range was:
1:2:3:4
I need to delete number 3 - which would leave:
1:2:4
How can I do this?
:0/
Perch
Re: [Perchpole] Manipulating Breadcrumbs
By Jason - July 4, 2012
Hi Perch,
Try something like this:
EXAMPLE
Try something like this:
EXAMPLE
$numberToRemove = "3";
$siblingLineage = str_replace(":$numberToRemove:", "", $siblingLineage);
$siblingLineage = str_replace("$numberToRemove:", "", $siblingLineage);
$siblingLineage = str_replace(":$numberToRemove", "", $siblingLineage);
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Manipulating Breadcrumbs
By Perchpole - July 4, 2012
Blimey!
All of that to remove one number!
:os
Perch
All of that to remove one number!
:os
Perch