Hi,
I'm just starting out trying to write a module, and I went through the module development tutorial, which btw was a life saver.
Now I'm stuck trying to do the most basic thing.
I can't figure out how to have my module insert some html or javascript into the header.
I'm looking at the search module for inspiration, but I can't figure out how it works.
There seems to be some magic going on with blocks and preloads.inc, can anyone explain how preload works?
Or maybe show me a simple example of how to add a block?
Any advice would be appreciated.
Cheers,
piam
Posts: 8339
take a look at a module which does this like the slideshow module.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 5
Thanks Suprsidr,
I'm checking that out now.
A quick question, I notice that some modules are compiled, is that a necessity?
I couldn't find any information on that, I'm not sure what is being compiled or why, did I miss something in the tutorial?
Cheers,
piam
Posts: 8339
if you use $template->javascript('lib/my.js'); then it gets compiled, but you can add it directly to your templates as well.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 5
Can I ask what IDE you guys use?
Right now I use notepad++, but I would like to use something with auto complete and other intellisense features.
Posts: 8339
try netbeans
I personally use Aptana Studio, but mine is an older version before they screwed-up the php support.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 5
I *was* using Aptana before, and I got tired of pulling my hair out, and went to notepad++.
I'll try netbeans, thanks.
So I'm thinking that reverse engineering from slideshow is a bit much.
All I want to do is shove some javascript into a block thats on every page.
I'm a little surprised by how non-trivial that is.
I's there a simple way of doing this that I'm missing?
--piam
Posts: 8339
put it in your block template.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 5
I'm not at all clear on how to get a block template to load.
I'm trying to do that using this info: http://codex.gallery2.org/Gallery2:How_To_Create_Blocks
So in this case, they have some stuff in Example.tpl and blocks.inc shoves Example it into an $blocks array.
After that, when/why does it ever come up?
As it stands just following the instructions on that page and adding a block template to my basic tutorial page does nothing.
should I be seeing something, or am I missing a step?
Cheers,
piam
Posts: 8339
I cannot give you more detailed tutorial than the one you reference.
But don't forget to add the block to your display in your theme settings.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2