include "echo $OUTPUT->main_content() "

include "echo $OUTPUT->main_content() "

by Alan Kmiecik -
Number of replies: 9

Just got the following message trying to restore a backedup course from another site...

Coding error detected, it must be fixed by a programmer: page layout file /home/akmiecik/public_html/CFPKnoxville/theme/aquinas/layout/ does not contain the main content placeholder, please include "<?php echo $OUTPUT->main_content() ?>" in theme layout file.

Hoping to find a simple answer as to where the code is to be placed?

Running Moodle 2.2 with modification of Formal White (which has been running fine).

Average of ratings: -
In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Alan Kmiecik -

Comparing to another theme it seems to go under the class="region-content" div in each of the files in the layout folder of the theme BUT, why is it not there and why does "echo core_renderer::MAIN_CONTENT_TOKEN" show up in that place in the files?

Allows me to backup course but not restore.

I have this Moodle setup installed in a total of five instances, has been working fine until just now and I can not think of anything obvious I did to change it.  

Anyway, all other instances do NOT have $OUTPUT->main_content() in the file mentioned only "echo core_renderer::MAIN_CONTENT_TOKEN"

I'm contemplating theme incompatibility but it has been working fine until today.

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Alan Kmiecik -

Using Moodle 2.2.1 (Build: 20120109)

Theme (originally formal white) version.php file reads:

* @package theme
* @subpackage aquinas
* @copyright Mediatouch 2000 (http://mediatouch.it/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2011061301; // The current module version (Date: YYYYMMDDXX)
$plugin->component = 'theme_aquinas';
$plugin->requires = 2010080300; // Requires this Moodle version
$plugin->maturity = MATURITY_STABLE;

 

URLs are http://aquinascollegecatechetics.org/CFPKnoxville/ and http://aquinascollegecatechetics.org/CFPNashville/

Both URL's go to same database but each have their own moodledata folder.

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Moodle has changed the way it outputs the MAIN CONTENT. Basically all you need to do is remove the old code and add the new.

Formal white has changed quite a lot so I would check to see what that code looks like now as you may want to benefit from these new settings and such.

HTH

Mary

In reply to Mary Evans

Re: include "echo $OUTPUT->main_content() "

by Alan Kmiecik -

Don't get it.   mixed  After all that, I gave up.  Put the code back to read  php echo core_renderer::MAIN_CONTENT_TOKEN, as it was previously.

Rebooted, had lunch came back and it works.  Whatever.

Given what I put up there for the theme level, I pretty sure I am at the 2.0 level for the theme (got all the messages about 1.9 not working with 2.0) so, am I?

And which is old code which is new:

i.e. is echo core_renderer::MAIN_CONTENT_TOKEN old or new

Thank you for the time you put into monitoring this forum.

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Alan Kmiecik -

Mary, just an FYI

I've been pluggin along here trying to restore a topic/activity into existing couse. 

Everything ran fine except I can not figure out how to get it to show up in existing course. 

Did the process about five times. 

Decided to go search for help.  Came back to try again and got the error listed above.

So, in this case.  Nothing changed but something is causing this error to pop-up intermittently. 

Thanks

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Ok...calm down...have a break.

When I refered to OLD code I was referring to

<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>

The new code is this...

<?php echo $OUTPUT->main_content() ?>

After makeing the changes you MUST do a Purge all caches in Site Administration > Development > Purge all caches this is very important.

It may even be worth your while clearing the browser cache too.

Once this is done then you can go back into your theme. and if necessary go to Site Administration Notifications just to see if there is any notification that you have made these changes...I do have any problems with my site as it's not a production site I have little ot no courses as such just enough content to do some theme testing, so I don't come across these error messages.

I hope this explains it all?

Mary

In reply to Mary Evans

Re: include "echo $OUTPUT->main_content() "

by Alan Kmiecik -

Interesting,  it blew up. (see how calm I said that!)

  1. Made the code change to the three php files in the layout directory
  2. Purged all the caches (browser included)
  3. Went back and the templated is messed up right after the header area (based on my css experience, despite the fact that I change the code in the main content area, looks the messup is before that)
  4. Can't clear caches again because menu and blocks are messed up

Going to go to backup copy and hope it restores properly.

Bummer...restore did not work, I gotta figure out how to get to that clear cache without the menu there (should be able to figure out the URL)

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

yoursite/admin/purgecaches.php should be the url you are after Alan.

Given the issues you're having with the theme seeming to be corrupted, can i just ask (apologies if Mary has already suggested this, I couldn't see it in the thread, but I may have missed it at 5am!!) Are you on a webhost using cPanel and if so did you upload the theme in the same way? Using ftp on a cPanel host seems to corrupt many files for some unknown (to me) reason

Richard

In reply to Alan Kmiecik

Re: include "echo $OUTPUT->main_content() "

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Alan,

Given that you were getting warnings about Moodle 1.9 in Moodle 2.2.1 suggest to me that this is nothing to do with the theme you sent me but more to do with the fact you may have done the upgrade wrongly. I know that in Moodle 1.9 you could just overwrite your existing files and folders. However...when Moodle 2.0 was introduced and given the number problems reported at that time, Moodle 2.x.x in much easier to upgrade from Moodle 1.9.x however there are Install Instructions with every download of Moodle. In these instructions it explains that you need to install this as a FRESH install and NOT on top of existing files and folders.

From what I can gather is that this is what happened in your upgrade. You may well have had some old Moodle 1.9 theme files in your moodle/theme directory.  Indeed your theme directory  may contain depreciated code and files, not to mention other areas of your site.

Given that you have 2 installations using one database, this is beginning to sound like a nightmare scenario. I hope I am wrong!

Mary