Problem Description
7 and i want to make some modifications in the header of page.
The modification is get the teacher name of the course and put them in the header when user click in the course.
But the problem is: When i put the next code in the header, the page show in blank, somebody know the reason?
This is my code:
<a class="logo" href="<?php echo preg_replace("(https?:)", "",
$CFG->wwwroot); ?>"
title="<?php print_string('home'); ?>">
</a>
<div id="course_name">
<?php
$courseid = $PAGE->course->id;
if ($courseid==1) {}
else {
$coursename = $PAGE->course->shortname;
echo $coursename;
}
?>
</div>
<div id="teacher_name">
<?php
if ($course->has_course_contacts()) {
foreach ($course->get_course_contacts() as $userid => $coursecontact) {
$name = $coursecontact['rolename'].': '.
html_writer::link(new moodle_url('/user/view.php',
array('id' => $userid, 'course' => SITEID)),
$coursecontact['username']);
echo $name;
}
}
?>
</div>
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?