in lib/misc.functions.php add
Code: Select all
function clean_urls($my_ID) {
global $gCms;
global $config;
$thispage = $page;
$thispage = $my_ID;
$trail = "";
$delimiter = "/";
#Make an array for all pages
$allcontent = array();
#Load current content
$onecontent = ContentManager::LoadContentFromId($thispage, false);
if ($onecontent !== FALSE)
{
array_push($allcontent, $onecontent);
#Grab all parents and put them into the array as well
while ($onecontent->ParentId() > 0)
{
$onecontent = ContentManager::LoadContentFromId($onecontent->ParentId(), false);
// tdh add / modify next 5 lines
if (isset($params['root']))
{
if (strtolower($onecontent->Alias()) != strtolower($params['root']))
{
array_push($allcontent, $onecontent);
}
}
else
{
array_push($allcontent, $onecontent);
}
}
#Pull them one by one in reverse order to construct a breadcrumb list
$first=1;
while ($onecontent = array_pop($allcontent))
{
if($first) {
$trail = $onecontent->getURL();
$strip = count_chars($config["page_extension"]);
$trail = substr($trail, 0, -5);
$trail .= $delimiter;
$first=0;
} else {
$trail .= $onecontent->MenuText() . $delimiter;
}
}
$trail = substr($trail, 0, -1);
$trail .= $config["page_extension"];
return $trail;
}
}
in modules/CSSMenu/CSSMenu.module.php edit lines
Code: Select all
if ($onecontent->Id() == $gCms->variables['content_id'])
{
$menu .= "<li class=\"menuactive\"><a href=\"".$onecontent->GetURL()."\"";
}
else
{
$menu .= "<li><a href=\"".$onecontent->GetURL()."\"";
}
Code: Select all
if ($onecontent->Id() == $gCms->variables['content_id'])
{
# $menu .= "<li class=\"menuactive\"><a href=\"".$onecontent->GetURL()."\"";
$menu .= "<li class=\"menuactive\"><a href=\"".clean_urls($onecontent->Id())."\"";
}
else
{
# $menu .= "<li><a href=\"".$onecontent->GetURL()."\"";
$menu .= "<li><a href=\"".clean_urls($onecontent->Id())."\"";
}
Code: Select all
RewriteEngine On
#Rewrites anything/page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*/)?([a-zA-Z0-9\.]+)\.html$ index.php?page=$2 [QSA]
$config['page_extension'] = '.html';
$config['assume_mod_rewrite'] = true;
try it, tested with news module and it should fallback to "messyURL"
thanks go to breadcrumbs, most of the function is copy paste from there