Imagine 2 and Mystuff integration problems

Imagine 2 and Mystuff integration problems

by Dan Leighton -
Number of replies: 2
Hi (probably Julian smile

I have a (slightly, but not unduly) modified version of your wonderful Imagine2 theme running on our site.

I have (finally) managed to get Mystuff integrated and working...but the display with Mystuff is woeful. It appears that Mystuff normally strips out the header info from any moodle theme (it certainly does with the cornflower theme for instance). But with imagine2 the header appears to force its way back in.

Any ideas of what I need to do to stop this problem. I enclose screenshots and page source below. Mystuff installation is entirely uncustomised from the latest release at present.

This is a copy of the moodleHeader.php file in MyStuff which I believe controls the way in which themes are used with MyStuff. I can't figure out why the final 4 lines aren't doing the job they should and stripping out the theme info.

<?php // $Id: moodleHeader.php,v 1.6 2007/07/11 10:19:18 dtl25 Exp $
 // index.php - the front page.
 if (!file_exists(dirname(__FILE__) . '/../../../config.php')) {
 header('Location: install.php');
 die;
 }
 global $CFG, $SITE;
 if (empty($CFG) or empty($SITE)) {
 redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
 }
 if ($CFG->forcelogin) {
 require_login();
 }
 if (get_moodle_cookie() == '') {
 set_moodle_cookie('nobody'); // To help search for cookies on login page
 }
 if (empty($CFG->langmenu)) {
 $langmenu = '';
 } else {
 $currlang = current_language();
 $langs = get_list_of_languages();
 $langlabel = '<span class="accesshide">'.get_string('language').':</span>';
 $langmenu = popup_form($CFG->wwwroot .'/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
 }
 $wwwroot = $CFG->wwwroot;
 $context = ContextHelper::getContext();
 $id = $context['moodleID'];
 $editor = loadeditor($id);
 $portfolioStyleHeader = <<<EOF
<link href="$wwwroot/mod/portfolio/html/_design/screen.css" rel="stylesheet" type="text/css" media="screen"/>
<link href="$wwwroot/mod/portfolio/html/_design/print.css" rel="stylesheet" type="text/css" media="print"/> 
<script type="text/javascript" src="$wwwroot/mod/portfolio/html/_javascript/javascriptLib.js"></script>
<script type="text/javascript" src="$wwwroot/mod/portfolio/html/_javascript/xforms-js.php"></script>
<script type="text/javascript" src="$wwwroot/mod/portfolio/library/dateSelector/dateSelector.js"></script>
<script type="text/javascript" src="$wwwroot/mod/portfolio/library/mediaPlayer/mediaPlayer.php"></script>
<!-- Alternative HTML Editor
<script type="text/javascript" src="$wwwroot/mod/portfolio/html/_javascript/widgEditor/scripts/widgEditor.js"></script>
<link href="$wwwroot/mod/portfolio/html/_javascript/widgEditor/css/widgEditor.css" rel="stylesheet" type="text/css"/>
-->
<!--1234567890HEADERSCRIPTINCLUDE0987654321-->
EOF;
 /* Function prototype...
 function print_header ($title='',
 $heading='',
 $navigation='',
 $focus='',
 $meta='',
 $cache=true,
 $button='&nbsp;',
 $menu='',
 $usexml=false,
 $bodytags='',
 $return=false)
 */
 $header = print_header('1234567890HTML-PAGE-TITLE0987654321',
 '',
 'home',
 '',
 '',
 true,
 '',
 user_login_string($SITE).$langmenu,
 $usexml=false,
 $bodytags='',
 $return=TRUE
 );
 $header = str_replace("</head", $portfolioStyleHeader . "\n\n</head", $header);
 echo $header;
 /*
 * This is deliberate to remove the Moodle standard headers which we dont want to use anyway
 *
 $removeStartPos = strpos($header, '<div id="header-home" class="clearfix">');
 $removeEndPos = strpos($header, '<div class="clearer">');
 $header1 = substr($header, 0, $removeStartPos);
 $header2 = substr($header, $removeEndPos);
 echo $header1.$header2;
 
*/
?>


My stuff page with imagine theme in place:
mystuffimagine.png

Mystuff with cornflower theme (looks normal):
mystuffcornflower.png

Normal theme in use:
imaginenormal.png

Hope someone can help!

Dan
Average of ratings: -
In reply to Dan Leighton

Re: Imagine 2 and Mystuff integration problems

by Julian Ridden -
Sadly I don't have direct answer. But I can confirm what you are seeing.

Have you contacted the author of MyStuff. Hopefully he can provide some direct feedback.

Julian
In reply to Dan Leighton

Re: Imagine 2 and Mystuff integration problems

by Shane Elliott -
Picture of Core developers Picture of Plugin developers
I assume you are talking about the following 4 four lines which are currently commented out:
 $removeStartPos = strpos($header, '<div id="header-home" class="clearfix">');
 $removeEndPos = strpos($header, '<div class="clearer">');
 $header1 = substr($header, 0, $removeStartPos);
 $header2 = substr($header, $removeEndPos);
My guess is that the Imagine2 theme doesn't use <div id="header-home .... in header.html hence the string search fails.