Author Topic: Incorrect output from $ccms[breadcrumb]  (Read 807 times)

youcantryreachingme

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +1/-0
    • View Profile
Incorrect output from $ccms[breadcrumb]
« on: August 19, 2009, 03:14:10 PM »
lib/sitemap.php contains the following line:

Code: [Select]
$ccms[breadcrumb] = "<span class=\"breadcrumb\">&raquo; <a href=\"/\" title=\"".ucfirst($cfg[sitename])." ".$cfg[homepage]."\">".ucfirst($cfg[homepage])."</a>";
If the system is installed under any directory other than root, this produces incorrect results.

To fix this in my system I have added a new variable to /lib/config.inc.php as follows:

Code: [Select]
//KM
// $cfg[root] must have trailing slash
$cfg[root] = "localhost/dev/compactcms/dev/";

Then the line in lib/sitemap.php gets updated to this:

Code: [Select]
$ccms["breadcrumb"] = '<span class="breadcrumb">&raquo; <a href="http://'.$cfg["root"].'" title="'.ucfirst($cfg["sitename"]).' '.$cfg["homepage"].'">'.ucfirst($cfg["homepage"]).'</a>';
I use $cfg["root"] in many places, including links to the css files.

youcantryreachingme

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +1/-0
    • View Profile
Re: Incorrect output from $ccms[breadcrumb]
« Reply #1 on: August 19, 2009, 03:17:52 PM »
PS - following lines in sitemap need updating too :)

Xander

  • Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 240
  • Karma: +5/-0
    • View Profile
    • CompactCMS.nl
Re: Incorrect output from $ccms[breadcrumb]
« Reply #2 on: August 28, 2009, 02:52:03 PM »
You are right that currently it's buggy... My bad (duh ;)).

But how about changing:

Code: [Select]
$ccms[breadcrumb]    = "<span class=\"breadcrumb\">&raquo; <a href=\"/\" title=\"".ucfirst($cfg[sitename])." ".$cfg[homepage]."\">".ucfirst($cfg[homepage])."</a>";

to:

Code: [Select]
$ccms[breadcrumb]    = "<span class=\"breadcrumb\">&raquo; <a href=\"./\" title=\"".ucfirst($cfg[sitename])." ".$cfg[homepage]."\">".ucfirst($cfg[homepage])."</a>";

Or stated otherwise: replace the a href="/" with a href="./". When I change this locally, it seems to work. Still another variable specifying the root wouldn't be a bad idea. It might help with other (future) location issues (for e.g. modules) too.

Cheers,
Xander.
Don't ever hold back your suggestions. Help me either to improve CompactCMS or spread the word about it on sites such as Twitter, Digg, StumbleUpon, etc :). Thanks!

youcantryreachingme

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +1/-0
    • View Profile
Re: Incorrect output from $ccms[breadcrumb]
« Reply #3 on: September 02, 2009, 04:20:38 PM »
Still another variable specifying the root wouldn't be a bad idea. It might help with other (future) location issues (for e.g. modules) too.

Yep - that's exactly why. I have a mod in a subdirectory, so referring to "./" just takes you to the current directory, not the root of the site.