Themes

Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post

 
Picture of dina patil
Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi , When i click on "Upcoming events", "Go to calendar..." OR "New Event...". It will give me this Error "Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post" Can anyone please tell me what is going wrong??? Thanks Mangesh
 
Average of ratings: -
It's only an avatar...
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters
Which theme are you using for Moodle 2.0 as that code is now out of date. Side-posts are now Blocks. If I am wrong...I'll check back and edit this post.

EDIT!

I was wrong...I thought it was something to do with this change to the layout which happened earlier this year.

http://moodle.org/mod/forum/discuss.php?d=149561

The error you have

"Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post"

I've come across it, but I just can't remember why it happens. I think is's something to do with the fact there is nothing to report, so instead of the message saying No Events or whatever it comes back with the error message.

But then again...I'm probably wrong!

Sam Hemelryk will know...he knows everything! smile
 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry,

Yes still i am getting the same error..

Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post

More information about this error


See the attached image..

Please help me to fix this sad

Thanks
Mangesh

 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry,

I am using formal_white theme , ad did some customization in lib/outputrenderers.php to add one more additional DIV at the end of every blocks

function block(block_contents $bc, $region) {
if($region == 'side-pre'){
$bc = clone($bc); // Avoid messing up the object passed in.
if (empty($bc->blockinstanceid) || !strip_tags($bc->title)) {
$bc->collapsible = block_contents::NOT_HIDEABLE;
}
if ($bc->collapsible == block_contents::HIDDEN) {
$bc->add_class('hidden');
}
if (!empty($bc->controls)) {
$bc->add_class('block_with_controls');
}

$skiptitle = strip_tags($bc->title);
if (empty($skiptitle)) {
$output = '';
$skipdest = '';
} else {
$output = html_writer::tag('a', get_string('skipa', 'access', $skiptitle), array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'));
$skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
}

$output .= html_writer::start_tag('div', $bc->attributes);

$controlshtml = $this->block_controls($bc->controls);

$title = '';
if ($bc->title) {
$title = html_writer::tag('h2', $bc->title, null);
}

if ($title || $controlshtml) {
$output .= html_writer::tag('div', html_writer::tag('div', html_writer::tag('div', '', array('class'=>'block_action')). $title . $controlshtml, array('class' => 'title')), array('class' => 'header'));
}
//Modified by Mangesh Aug 21 2010 to set extra DIV after contents
$output .= html_writer::start_tag('div', array('class' => 'lft_cont_bg_rep'));
$output .= html_writer::start_tag('div', array('class' => 'content'));
if (!$title && !$controlshtml) {
$output .= html_writer::tag('div', '', array('class'=>'block_action notitle'));
}
$output .= $bc->content;


if ($bc->footer) {
$output .= html_writer::tag('div', $bc->footer, array('class' => 'footer'));
}


$output .= html_writer::end_tag('div');

$output .= html_writer::end_tag('div');
//Modified by Mangesh Aug 21 2010 to set extra DIV after contents
$output .= html_writer::start_tag('div', array('class' => 'lft_bot_cor'));
$output .= html_writer::end_tag('div');

$output .= html_writer::end_tag('div');
//$output .= html_writer::tag('div', '', array('class'=>'none','id'=>'mangesh1'));
//$output .= html_writer::end_tag('div');
if ($bc->annotation) {
$output .= html_writer::tag('div', $bc->annotation, array('class' => 'blockannotation'));
}
$output .= $skipdest;

$this->init_block_hider_js($bc);
return $output;
/////////////////////////////////////////////////// Modified on 20-Aug-2010 by Mangesh ///////////////
}else if($region == 'side-post'){
$bc = clone($bc); // Avoid messing up the object passed in.
if (empty($bc->blockinstanceid) || !strip_tags($bc->title)) {
$bc->collapsible = block_contents::NOT_HIDEABLE;
}
if ($bc->collapsible == block_contents::HIDDEN) {
$bc->add_class('hidden');
}
if (!empty($bc->controls)) {
$bc->add_class('block_with_controls');
}

$skiptitle = strip_tags($bc->title);
if (empty($skiptitle)) {
$output = '';
$skipdest = '';
} else {
$output = html_writer::tag('a', get_string('skipa', 'access', $skiptitle), array('href' => '#sb-' . $bc->skipid, 'class' => 'skip-block'));
$skipdest = html_writer::tag('span', '', array('id' => 'sb-' . $bc->skipid, 'class' => 'skip-block-to'));
}

$output .= html_writer::start_tag('div', $bc->attributes);

$controlshtml = $this->block_controls($bc->controls);

$title = '';
if ($bc->title) {
$title = html_writer::tag('h2', $bc->title, null);
}

if ($title || $controlshtml) {
$output .= html_writer::tag('div', html_writer::tag('div', html_writer::tag('div', '', array('class'=>'block_action')). $title . $controlshtml, array('class' => 'title')), array('class' => 'headerright'));
}
//Modified by Mangesh Aug 21 2010 to set extra DIV after contents
$output .= html_writer::start_tag('div', array('class' => 'rgt_cont_bg_rep'));

$output .= html_writer::start_tag('div', array('class' => 'content'));
$output .= html_writer::start_tag('div', array('class' => 'coustombgimage'));
if (!$title && !$controlshtml) {
$output .= html_writer::tag('div', '', array('class'=>'block_action notitle'));
}

$output .= $bc->content;

if ($bc->footer) {
$output .= html_writer::tag('div', $bc->footer, array('class' => 'footer'));
}
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('div');

//Modified by Mangesh Aug 21 2010 to set extra DIV after contents
$output .= html_writer::start_tag('div', array('class' => 'rgt_bot_cor'));
$output .= html_writer::end_tag('div');

$output .= html_writer::end_tag('div');
//$output .= html_writer::tag('div', '', array('class'=>'none','id'=>'mangesh1'));
//$output .= html_writer::end_tag('div');
if ($bc->annotation) {
$output .= html_writer::tag('div', $bc->annotation, array('class' => 'blockannotation'));
}
$output .= $skipdest;

$this->init_block_hider_js($bc);
return $output;

} ////////////////End of Coustom IF by Mangesh
}


But i don't think that this error

Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post

is coming due to this modifications.

Please HEEEEEELLLLLLPPPPPPP me sad


Thanks
Mangesh



 
Average of ratings: -
It's only an avatar...
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters
My brain hurts reading all that code!

I can't read this too well...gosh I'm only just learning it myself, but have you declared in all of that code you wrote, where the new div will be?

You talk about 'content' but content class is uses in region-main, region-pre, and region-post. So which part of the layout are you hoping to put this new div (box)?

Mary ( I need to lie down after this! LOL)
 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry,

Its very easy ,i am also new in moodle just 15 days ago i started working on moodle 2.0 smile

The new dives are

1) $output .= html_writer::start_tag('div', array('class' => 'lft_cont_bg_rep'));

and

2) $output .= html_writer::start_tag('div', array('class' => 'rgt_cont_bg_rep'));

To get round curve at the corners of left and right side blocks.

but still not found the solutions of that side-post error sad

What to do ?

See the snap shot of my site...

Thanks
Mangesh

 
Average of ratings: -
It's only an avatar...
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters
Hi Mangesh,

Your site looks great!
When you get this to work...what will the new dix box contain?

Mary

 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry ,

I just modified the css and general.php of formal_white theme folder .
and write lots of PHP code in theme/formal_white/layout/general.php.

Also changed the lots of base css according to my need.


But the problem still there since i am working on moodle from last 15 days only so i didn't understand why this error comes

Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post

More information about this error

sad

Any Idea ????????????

Thanks
Mangesh
 
Average of ratings: -
It's only an avatar...
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters
Well if you keep adding more php code and mess with base css, who knows how to fix this now without seeing the whole theme you have put together.

You need to stop and assess what's happening to make the error show up in the first place. Perhaps you are trying to do too much, just for the sake of doing something different.

Just keep it simple. Get one element to work at a time. Otherwise you will get frustrated and waste a lot of time for nothing.

Mary


 
Average of ratings: -
Picture of Daniele Cordella
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersParticularly helpful MoodlersPlugin developers
Ciao Mangesh what you write WAS an issue of this theme but has been fixed time ago. Are you sure you are using the last release?
 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry,

I am using latest version of moodle 2.0 and modified the theme formal_white inside the theme folder.

But the problem is still there.
I don't know why it is coming again..


Thanks
Mangesh
 
Average of ratings: -
Picture of dina patil
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hi Marry , Daniele ,

Thanks for your reply.

I found the solution smile

Now the problem is fixed , During modification of general.php of formal_white i missed one parameter . i have added that and its working fine......


Cheeeeeeeeerss

Mangesh


 
Average of ratings: -
Francis Vila
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 

I have the same error.  Could you specify what parameter you added in to solve the problem? That might save some time for people coming to the page in hope of a solution...

 
Average of ratings: -
Picture of Sami Hwang
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 

Let me ask one thing.

As long as we are familiar with PHP and CSS, we can tweak code one at a time (as Mary advised) and can have a very customizable design in Moodle? That is a huge difference from Blackboard, right?

What is the best way of learning PHP in general, Moodle php in particular? I am a multimedia guy, not a programmer. But I would love to learn  a programming lanaguage.

 

Sami

 
Average of ratings: -
Andrew Normore
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 

Here is the answer:

1) Go in to your /moodle/theme/mybrokentheme/config.php

Look through the list for something that looks like this:

 

'login' => array(
  'file' => 'general.php',
  'regions' => array(),
  'options' => array('langmenu'=>true),
),

See how regions' array has nothing in it? Change it to this:

'regions' => array('side-pre'),

 

 
Average of ratings: -
Picture of Richard Oelmann
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersParticularly helpful MoodlersPlugin developersTesters

Andrew,

i don't think that was the problem for Mangesh when this post was written two and a half years ago. He had modified the code and left out a parameter in the additions he had made.

You can have a layout with no regions called in the config.php as in your example. The layout file should (as in all the core themes such as the formal white one Mangesh was using) contain code which then detects the regions being used and whether to attempt to display them or not.

The 'Coding error detected' error message is usually just that - an error in the code, sometimes as 'minor as a comma instead of a semicolon, a < in the wrong place.

Richard

 
Average of ratings: -
It's only an avatar...
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Adding to Richards comment, I would also like to say that the block region in the config.php is not the only place the problem could have stemmed from, but also the layout files where class="block-region" is missing.

Also and more important, the code you suggest is actually wrong, as you added side-pre whereas the problem in this situation actually references side-post.

But thanks for your input as it gives others oportunity to explore moodle theme code, and read the Moodle theme tutorials that have been written to help in these situations. smile

Link to Moodle Themes' tutorials http://docs.moodle.org/en/Development:_Themes_2.0

CLICK HERE for more tutorials

Mary

 
Average of ratings: -
Picture of Mohamed Ghasia
Re: Coding error detected, it must be fixed by a programmer: Trying to reference an unknown block region side-post
 
Hello All,

I am just new and not sure if the error got fixed. I solved the same error in moodle 2.7 through purge all caches. site administration -> development -> purge all caches -> click the button.


thanks

 
Average of ratings: -