Macas
Macas

Reputation: 560

Mageno module idea

I'm working on Magento modules. After few guides I managed to create module that says "hellow world". Also I have made some of css code that add simple image border around whole page.

So the problem is: how to combine them together? I want that when I install my module, image border appears around page. What should I be looking for? Any tips? I need right path to look for answers

T.y.

Upvotes: 0

Views: 37

Answers (1)

Alana Storm
Alana Storm

Reputation: 166066

You need to to

  1. Create a module

  2. That modifies the global layout such that your CSS is added to the page

Re: number two, there's multiple ways to go about doing this. These days I favor the event/observer method

  1. Add an observer for the controller_action_layout_generate_blocks_after event

  2. Fetch the head block from the layout in your observer method

  3. If you find a head block, add your CSS file to it programtically

The more traditional way is

  1. Configure you module to include an additional layout update XML file

  2. In the default handle of your new layout update XML file, add XML that tells Magento to add your CSS file

That should give you enough to google on and come back with more specific questions. Good luck!

Upvotes: 1

Related Questions