Breadcrump Modification (help)

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Breadcrump Modification (help)

Post by phalancs »

Hi Freaks, I need your help:

What i want to do:
I want to prevent the breadcrump menu to display the first Structure!

Example:

|-Webroots
--www.enym.com [10]
---services
---feelings
---whatever
--www.phorce.de [20]
---damn
---exgirlfriend
---goaway

If I use it like: {BREADCRUMB:10}
then it always shows the first item as "www.enym.com" but i want this to be called "home" or whatever.
I could make such a link on my own and would love to make the breadcrump NOT show the initial thing.

Any Ideas? I am sure i have to edit somehting in the "include/inc_front/front.func.inc" in this part:

Code: Select all

// -------------------------------------------------------------

function get_breadcrumb ($start_id, $struct_array) {
	//returns the breadcrumb path starting with given start_id
	$data = array();
	while ($start_id) {
		$data[$start_id] = $struct_array[$start_id]["acat_name"];
		$start_id		 = $struct_array[$start_id]["acat_struct"];
	}
	if(!empty($struct_array[$start_id]["acat_name"])) {
		$data[$start_id] = $struct_array[$start_id]["acat_name"];
	}
	return array_reverse($data, 1);
}

// -------------------------------------------------------------

function breadcrumb ($start_id, $struct_array, $end_id, $link_to="index.php", $spacer=" > ") {
	//builds the breadcrumb menu based on given values
	//$link_to = the page on which the breadcrum part links
	//$root_name = name of the breadcrumb part if empty/false/0 $start_id
	//$spacer = how should breadcrumb parts be divided
	
	$start_id = intval($start_id);
	$end_id = intval($end_id);
	$act_id = $start_id; //store actual ID for later comparing
		
	while ($start_id) { //get the breadcrumb path starting with given start_id
		$data[$start_id] = $struct_array[$start_id]["acat_name"];
		$start_id		 = $struct_array[$start_id]["acat_struct"];
		if($end_id && $start_id == $end_id) break;
	}
	$data[$start_id] = $struct_array[$start_id]["acat_name"];
        
        //enym: das erste element aus dem array löschen
        //$deleted_element = array_shift($data);
        
	$crumbs_part = array_reverse($data, 1);	
        
        //enym: das erste element aus dem array löschen
	//$deleted_element = array_shift($crumbs_part);
        
	if(is_array($crumbs_part) && count($crumbs_part)) {
		$breadcrumb = "";
		foreach($crumbs_part as $key => $value) {	
			$alias = '';
			if ($act_id != $key) {
				if($breadcrumb) $breadcrumb .= $spacer;
				if(!$struct_array[$key]["acat_redirect"]) {
					$breadcrumb .= '<a href="index.php?';
					$alias = $struct_array[$key]["acat_alias"];
					$breadcrumb .= ($alias) ? html_specialchars($alias) : 'id='.$key.',0,0,1,0,0';
					$breadcrumb .= '">';
				} else {
					$redirect = get_redirect_link($struct_array[$key]["acat_redirect"], ' ', '');
					$breadcrumb .= '<a href="'.$redirect['link'].'"'.$redirect['target'].'>';
				}
				$breadcrumb .= html_specialchars($crumbs_part[$key]).'</a>';
			} else {
				if($breadcrumb) $breadcrumb .= $spacer;
				$breadcrumb .= html_specialchars($crumbs_part[$key]);
			}
		}
	} else {
		$breadcrumb = "";
	}
	return $breadcrumb;
}

// -------------------------------------------------------------
2008
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi Phalancs,

Back from a holiday,
this is an easy one this morning :P

To modify any of your root(s) name(s):
01. Make yourself a great espresso
02. Go to your Site structure (ADMIN)
03. Edit your leading "category title:"
04. Click "Save & close"

To hide any of your root(s) name(s):
01. Make yourself a great espresso (if not already done) :wink:
02. Go to your Site structure (ADMIN)
03. Click the "hide" option from "frontend menu status:"

:!: Don't forget to clear your cache and or disable your cache,
to successfully monitor your changes.

Cheers,

Yves :wink:
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
Post Reply