What an odd thing

What an odd thing

Napisane przez: Helio Rocha ()
Liczba odpowiedzi: 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
W odpowiedzi na Helio Rocha

Re: What an odd thing

Napisane przez: 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.

W odpowiedzi na Jan Dierckx

Re: What an odd thing

Napisane przez: 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..,
W odpowiedzi na Helio Rocha

Re: What an odd thing

Napisane przez: 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?
W odpowiedzi na Jan Dierckx

Re: What an odd thing

Napisane przez: 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>
W odpowiedzi na Helio Rocha

Re: What an odd thing

Napisane przez: Jan Dierckx ()

Now, I get it... uśmiech 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>';
W odpowiedzi na Jan Dierckx

Re: What an odd thing

Napisane przez: 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!