General developer forum

 
 
Davo
Re: Error in adding a new block
Group DevelopersGroup Particularly helpful Moodlers

The error message is fairly clear 'Plugin installed in wrong folder'.

Look in your version.php file (and for installation errors it is usually helpful to reproduce the contents of your version.php in the forum post).

Find the line: $plugin->component = 'block_something_or_other';

If the component name is 'block_something_or_other', then it will need to be installed in 'blocks/something_or_other'. If the component is 'block_simple_html', then it will need installing in 'blocks/simple_html'.

Note the 'component' name should also match the name of the main file for the plugin (e.g. blocks/simple_html/block_simple_html.php) and the language file (e.g. blocks/simple_html/lang/en/block_simple_html.php)

 

 
Average of ratings:Useful (1)
Picture of Chirag Patel
Re: Error in adding a new block
 

Thanks davo, sorry for silly mistake, I am new for moodle and i have installed plugin successfully but now i have also one error

"Warning: Creating default object from empty value in C:\xampp\htdocs\moodle\blocks\simplehtml\block_simplehtml.php on line 26

This page should automatically redirect. If nothing is happening please use the continue link below.

Error output, so disabling automatic redirect."

you can visit code fro this plugin in link given by me in the upper post.

 
Average of ratings: -
Davo
Re: Error in adding a new block
Group DevelopersGroup Particularly helpful Moodlers

I'm afraid the link you give to the Moodle docs, doesn't make it clear about what is happening on line 26 of your code.

I suspect you've done something like this:

$randomobject->membervariable = 'some value or other';

Without first initialising $randomobject.

You should start by writing:

$randomobject = new stdClass();

Before you start assigning values to the member variables.

 
Average of ratings:Useful (1)
Picture of Chirag Patel
Re: Error in adding a new block
 

sorry for  my mistake I am new fro php also.

but code is like this.

ublic function

 

specialization() {

 

if (!empty($this->config->title))

{

$this->title = $this->config->title;

}

else {

$this->config->title = 'Default title ...';   \\error and i also don't get what is this line doing.

 

}

 

if (!empty($this->config->text))

{

$this->config->text = 'Default text ...';

}

}

 
Average of ratings: -