Adding Module Positions for Joomla 1.7, Gantry 3.2.12
Posted 13 years 1 week ago
I want to add a module row to the very top of the rt_gantry template. It going to be a "margin" with a graphic image in it. I found the tutorial "Adding Module Positions" but that is for Joomla 1.5 and it's apparently obsolete. I've been trying to pick my way through the files and come up with a solution. I've done pretty good but my new module is getting produced twice. Once where I want at the very top row of the template and then once outside the container at the very top left corner of the browser window.
Another issue is that it is not clearing the next module row to fall underneath. As an example, I have my new module row "top_margin" and then there is "top". I want them to display as:
top_margin
top
but the <div class="clear"></div> is not doing it's job and clearing after top_margin. However, if I remove that then it does! I don't understand that?
I'd appreciate some help on adding a module position row to this system. Thanks!
Re: Adding Module Positions for Joomla 1.7, Gantry 3.2.12
Posted 13 years 1 week ago
Hi Cliff, thanks and sorry for the delay in returning back here. I do have this on a server you could get to. I didn't do anything fancy. I tried to follow the Gantry demo for adding module positions as closely as possible. The demo is obsolete. I was able to find what I think is the correct place for all the code except this one line:
Re: Adding Module Positions for Joomla 1.7, Gantry 3.2.12
Posted 13 years 1 week ago
Hey, I fixed it, I've actually had this same problem before. As I suspected from what was happening, the issue is with the name of your positions. For some reason, Gantry doesn't like it when you use the same word in the name - like "top" - it was rendering your module in your new position and the actual top position, that's why it was there twice, it apparently can't tell the difference between top and top_margin.
All I did was change your position name to margin, instead of top_margin, in all of the files and it works fine. I don't know why it does this, you just have to use unique position names to avoid it in the future. Hope that helps.
The difficult we do immediately, the impossible takes a little longer.
Step 2 has you add the following code to the template's index.php file in the position where you want your module row to appear. If you want it before the Header you put it before the Header, if you want it after then you put it after.
Step 3 has you add the following code to the templatesDetails.xml file. Following the format of the above step I pasted it into the sequential position of where the row will appear. I don't know if it matters on this one or not?
Re: Adding Module Positions for Joomla 1.7, Gantry 3.2.12
Posted 13 years 6 days ago
Nice write up.
One thing I'd like to add:
<?php echo $gantry->displayModules('example','standard','standard'); ?>
follows this pattern
<?php echo $gantry->displayModules('name','gantry-rendering','mod-chrome');
1. example = name of the module position. if you a have "standard'-module-rendering (see 2.) it will be example-a, example-b, example-c, example-d, example-e, example-f
2. standard = module-layout. It adds the grid-classes. (libraries/gantry/html/layouts/mod_standard.php). Positions will be created from a to f together with this part in template-options.xml
<param name="examplePosition" type="positions" default="6,6" label="Label" description="Description goes here">
<schemas>1,2,3,4,5,6</schemas>
<words>2,3,4,5,6,7,8,9,10</words>
</param>
(Just a very rough explanation. more here
www.gantry-framework.org/documentation/j...custom-module-chrome
www.gantry-framework.org/documentation/j...custom-module-layout
It also could be 'basic". In this case it would just render a position 'example'
3. standard = the mod_chrome that is used for the rendering around the modules you are publishing. You find the code in modules.php in the html folder of your template.
It is also used for the presentation of the title of the module.
In the basic-gantry template this is
Think of it like this: green is around a-f, orange is around each individual module
You can use that for advanced styling of module positions. Actually that is just where the fun begins ...
Btw:
template-options.xml <-- this is the one you are using
template-options.12.xml <-- this is just a "template" for 12 columns
template-options.16.xml <-- this is just a "template" for 16 columns
If you are using 16 columns just rename
template-options.xml to backup_template-options.xml
and
template-options.16.xml to template-options.xml