Donate!
JoomlaBear Forums
Welcome, Guest
Please Login or Register.
Lost Password?
Placing a module in the body of a page (1 viewing)
_GEN_GOTOBOTTOM Post Reply Favoured: 0
TOPIC: Placing a module in the body of a page
#41
johnmc (User)
Senior Boarder
Posts: 16
graphgraph
User Offline Click here to see the profile of this user
Placing a module in the body of a page 2007/09/11 16:23 Karma: 0  
Hi all,

I'm developing a site at http://www.editexcel.com/nisus/

I've downloaded the flash image module at http://www.joomlashack.com/index.php? option=com_content&task=view&id=170&Itemid=15

Installed and working fine. However, at the moment I can only publish it to either the left or top of the page (you will see it at the bottom of the left coloumn). I would like to replace one of the static images currently in the main body with the module.

Is this possible? If so how?

Many thanks in advance,

johnmc
  The administrator has disabled public write access.
#42
Big Bear (Admin)
Admin
Posts: 211
graph
User Offline Click here to see the profile of this user
Re:Placing a module in the body of a page 2007/09/12 00:55 Karma: 17  
Hi John

I believe someone has written an extension that lets you publish a module in your main content area but I'm not 100% sure - you'd need to dig around in http://extensions.joomla.org/

The other way is to add another module position to index.php either above or below the main content - This is very easy and I'll post some instructions shortly.

If you do add another module position it would bring up any content you had published inside it additional to the main content - and the content in your new module would display either above or below the main content depending on where you placed it in the template.

More soon
  The administrator has disabled public write access.
#43
Big Bear (Admin)
Admin
Posts: 211
graph
User Offline Click here to see the profile of this user
Re:Placing a module in the body of a page 2007/09/12 01:19 Karma: 17  
If you open index.php inside your Templates/NiftyCorners directory and locate the following code:

<div id="content">
<?php mosMainBody(); ?>
</div>

You could then add the php code to load a another module:
<?php mosLoadModules ( 'banner',-2 ); ?>

It would then look like this:
<div id="content">
<?php mosLoadModules ( 'banner',-2 ); ?>
<?php mosMainBody(); ?>
</div>

I have only used 'banner' because User1-User9 are already used in the left column.

Also note that by placing the additional banner module into the DIV with id "content" the module will be subject to the styling that has been applied to #content in NiftyLayout.css

This can be a good thing - it will have same padding, etc

If this isn't working for you then you could add another div above or below the content div and and add styling for it in NiftyLayout.css

If you decide to go this route let me knwo and I'll give you some more tips

Post edited by: Big Bear, at: 2007/09/12 13:00
  The administrator has disabled public write access.
#45
johnmc (User)
Senior Boarder
Posts: 16
graphgraph
User Offline Click here to see the profile of this user
Re:Placing a module in the body of a page 2007/09/12 12:47 Karma: 0  
Big Bear wrote:


You could then add the php code to load a another module:
<?php mosLoadModules ( 'banner',-2 ); ?>



Hi Big Bear, thanks for the help again.

I tried doing this and it broke the template. However, it is now working after I added the code
Code:

  <div id="content"> <?php mosMainBody(); ?> <?php mosLoadModules ( 'nisus1' ); ?> <?php mosLoadModules ( 'nisus2' ); ?> <?php mosLoadModules ( 'nisus3' ); ?> </div>



I would now like to float the second and third module position to the right of the first one, giving them a specific width. I'm guessing this will be done in the css, would I have to create put them in three new layers for this?

Thanks again,

johnmc

Post edited by: Big Bear, at: 2007/09/12 13:04
  The administrator has disabled public write access.
#46
Big Bear (Admin)
Admin
Posts: 211
graph
User Offline Click here to see the profile of this user
Creating Custom Joomla Module Name/ Position 2007/09/12 13:05 Karma: 17  
Hi John,

Very sorry about that code example John, I just looked at it again and there was an extra { curly bracket - have removed from my example.

It's good you have it working but it looks like you are using custom module names - nisus1, etc

You'll need to add those custom names to your template module positions.

Just got to Site > Template Manager > Module Positions and add the names you have specified.



Post edited by: Big Bear, at: 2007/09/12 13:17

Post edited by: Big Bear, at: 2007/09/12 13:19
  The administrator has disabled public write access.
#47
Big Bear (Admin)
Admin
Posts: 211
graph
User Offline Click here to see the profile of this user
Re:Placing a module in the body of a page 2007/09/12 13:19 Karma: 17  
Hi John,

You're right about the layers/DIVS

You'll want to create a DIV with an ID around each of those module positions.

Code:

 <div id="content"> <?php mosMainBody(); ?> <div id="nisus1"> <?php mosLoadModules ( 'nisus1' ); ?> </div> etc, etc, </div>



You'd then create a class in your CSS as follows
Code:

 #nisus1 { floatleft; width200px; etcetc }



Obviously don't put my etc, etc in and the float and width properties are just examples.

If you get this done and still want more! you can make the modules
  • collapsable
  • i.e. they won't be published if no module is published in that position.

    All you need to do is wrap each DIV with the following php tags:
    <?php if (mosCountModules('nisus1')) { ?>
    <?php } ?>
    Code:

      <?php if (mosCountModules('nisus1')) { ?>  <div id="nisus1"> <?php mosLoadModules ( 'nisus1' ); ?> </div> <?php } ?>



    Hopefully that makes sense? You're simply using PHP to detect if the module has been published and if not then don't load the div either.

    Post edited by: Big Bear, at: 2007/09/12 13:33
      The administrator has disabled public write access.
    _GEN_GOTOTOP Post Reply
    Powered by FireBoardget the latest posts directly to your desktop