Problem:
All pages on my new Moodle site have a similar body element to this:
<body class="http:--ec281.lly.earlham.edu:16080-nitle_moodle- course-1"It doesn't seem to do any damage apart from screwing up Urs Hunkler's very impressive Accordion system.
id="http:--ec281.lly.earlham.edu:16080-nitle_moodle--index">
The body element *should* look like:
<body class="course course-1" id="site-index">
I traced the problem back to function print_header in weblib.php. The class and id attributes for the body element are generated by the function page_id_and_class on line 1872, page_id_and_class($pageid, $pageclass);
This function is located at line 4378 in weblib.php.
What this function should return in normal circumstances is $id='site-index' and $class='course'. But instead the whole URL is returned. I'm sure it has something to do with the global $ME variable but I cannot find a reference to where this is set. Relevant lines from the Moodle config.php:
$CFG->wwwroot = 'http://ec281.lly.earlham.edu/nitle_moodle';
$CFG->dirroot = '/Library/WebServer/Documents/nitle_moodle';
$CFG->dataroot = '/Library/WebServer/nitlemoodle_data';Here's what the page_id_and_class function is doing:
function page_id_and_class(&$getid, &$getclass) {
// Create class and id for this page
global $CFG, $ME;
static $class = NULL;
static $id = NULL;
if(empty($class) || empty($id)) {
SOmething weird happens here
$path = str_replace($CFG->httpswwwroot.'/', '', $ME); //Because the page could be HTTPSPAGEREQUIRED
$path = str_replace('.php', '', $path);
if (substr($path, -1) == '/') {
$path .= 'index';
}
if (empty($path) || $path == 'index') {
This should be what gets set:
$id = 'site-index';
$class = 'course';
} else if (substr($path, 0, 5) == 'admin') {
$id = str_replace('/', '-', $path);
$id = str_replace('admin2', 'admin', $id);
$class = 'admin';
} else {
But this happens instead and I don't know why:
$id = str_replace('/', '-', $path);
$class = explode('-', $id);
array_pop($class);
$class = implode('-', $class);
}
}
$getid = $id;
$getclass = $class;
}
Any assistance would be gratefully received.
Mark Pearson