aiyou Posted March 9, 2009 Share Posted March 9, 2009 Hello. First off, if there is a better way of doing this, please feel free to point it out... My objective is to modify the "Let's See What We Have Here" (/includes/languages/english/index.php HEADING_TITLE) with a subset of the breadcrumb, while still maintaining the functionality of the breadcrumb itself. For example... Top » Catalog » Hardware » Keyboards By replacing define('HEADING_TITLE', 'Let\'s See What We Have Here') With define('HEADING_TITLE', $breadcrumb->trail($breadcrumb->trail(' » '))) Yields a dynamic category description of: Top » Catalog » Hardware » Keyboards However, all I want it to display is: Hardware » Keyboards And, I'm looking for the breadcrumb functionality to remain, so that the the user could click on 'Hardware' and be redirected to that parent category. By modifying /includes/classes/breadcrumb.php, around line 31 to for ($i=2, $n=sizeof($this->_trail); $i<$n; $i++) { I was able to 'suppress' the HEADER_TITLE_TOP and HEADER_TITLE_CATALOG (first two elements of the array), but this ended up breaking the build of the breadcrumb links, and if clicking on Hardware, the user is redirected to index/home page Any ideas??? Thanks. Rob Link to comment Share on other sites More sharing options...
aiyou Posted March 10, 2009 Author Share Posted March 10, 2009 Okay...I think I have something. Basic testing appears successful, but I'm sure there is a better way to handle the new function. In /classes/breadcrumb.php, I created a new function (placed before the closing } ?> ). Basically, it parses the preformed breadcrumb, stripping out the 1st and 2nd level links based on the defined separator (» if from the default) function trail_sub($trail_string, $separator) { $trailsub = ''; $trailsub = substr($trail_string,stripos($trail_string, $separator) + strlen($separator)); $trailsub = substr($trailsub,stripos($tmptrailsub, $separator) + strlen($separator)); return $trailsub; } Next, modified the /includes/languages/english/index.php file for the following defined HEADING_TITLE entries if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) { //define('HEADING_TITLE', 'Let\'s See What We Have Here'); define('HEADING_TITLE', $breadcrumb->trail_sub($breadcrumb->trail(' » '),(' » '))); -- and -- } elseif ($category_depth == 'nested') { //define('HEADING_TITLE', 'Categories'); define('HEADING_TITLE', $breadcrumb->trail_sub($breadcrumb->trail(' » '),(' » '))); I know that there has got to be an easier, or at least cleaner way, of coding for the creation of the $trailsub value. I'm guessing a basic FOR loop, but need to figure out how to code such a beast. I'm also thinking that I'm overdoing it with the variables that I'm passing around. Thoughts/opinions? Thanks for looking Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.