What an odd thing

What an odd thing

by Helio Rocha -
Number of replies: 6
Hello,

When I put some directory into a new block directory, the moodle doesn't load it... 

Sample

/moodle/blocks/myblock <- will be loaded
/moodle/blocks/myblock/mydir <- won't be loaded

Any ideas 'bout this?

Thanks in Advance,
Hélio Rocha
Average of ratings: -
In reply to Helio Rocha

Re: What an odd thing

by Jan Dierckx -

What should Moodle load in that directory?

The database scripts you asked about should be inside blocks/myblock/db/ They will be executed upon installation of the block. Code in other subdirectories will only be executed if your block class refers to it.

You have read the blocks howto that resides inside your blocks directory? The stuff about database is not in there (because most information about a block can be serialized and stored inside the block_instance table), but the rest of the Howto is really well written.

In reply to Jan Dierckx

Re: What an odd thing

by Helio Rocha -
Thanks for the answer, but the problem is not with the db folder... in my block folder, i have other folder where i have some classes and functions that i use in that block... i don't know if i'm making myself clear... sorry for my lousy english...

So, when i have an other folder (not db one...) in my block folder... moodle doesn't load my block...


P.S. - the folder inside my block folder doesn't have anything to be loaded, it only haves some files that are used by the block itself..,
In reply to Helio Rocha

Re: What an odd thing

by Jan Dierckx -
You have put require(_once) or include(_once) inside your code with a link to the files inside the subdirectory that are used by the block?
In reply to Jan Dierckx

Re: What an odd thing

by Helio Rocha -
No, because the only relationship with the block is a link...

like this:

/blocks/myblock/myview/index.php

and somewhere in /blocks/myblock/block_myblock.php i have:

<a href="myview/index.php">bla bla</a>
In reply to Helio Rocha

Re: What an odd thing

by Jan Dierckx -

Now, I get it... smile It might have been easier if you had attached a small part of the code.

You can use something like the following...

 '<a href="'.$CFG->wwwroot.'/blocks/myblock/myview/index.php'.'">'.
 get_string('bla_bla', 'myblock').'</a>';
In reply to Jan Dierckx

Re: What an odd thing

by Helio Rocha -
Hey, thanks and sorry...

Thanks for all your help and sorry for my lack of explaining...

This have been my first days in moodle development, everything seemed too fast, but this post proves that this is a real community!

Thanks!