Centre Banners in Joomla Banner Module

Discuss the development and implementation of Joomla! modules here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
scottm
Joomla! Intern
Joomla! Intern
Posts: 79
Joined: Mon Oct 24, 2005 1:59 pm

Centre Banners in Joomla Banner Module

Postby scottm » Tue Jun 20, 2006 3:45 pm

Hi,

I'm using the standard Joomla Banner Module but the advertisements are defaulted to a left position.

I have tried editing the mod_banner file but the advertisements still appear on the left.

Here is what i did at around line 84:

Code: Select all

echo '<div style=\"text-align:center;\"><a href="'. $link .'" target="_blank"><img src="'. $imageurl .'" border="0" alt="Advertisement" /></div></a>';


What am i doing wrong?

Scott

wildcard
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Fri Sep 16, 2005 9:59 am
Location: Ljubljana
Contact:

Re: Centre Banners in Joomla Banner Module

Postby wildcard » Tue Jun 20, 2006 8:46 pm

Try using

...


Marc Witteveen

scottm
Joomla! Intern
Joomla! Intern
Posts: 79
Joined: Mon Oct 24, 2005 1:59 pm

Re: Centre Banners in Joomla Banner Module

Postby scottm » Wed Jun 21, 2006 9:28 am

Its worked  ;D

That was so simple, sometimes the obvious can be overlooked  :-[

Thanks

harky
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Sat Sep 29, 2007 6:10 pm

Re: Centre Banners in Joomla Banner Module

Postby harky » Tue Mar 11, 2008 5:29 pm

may i know hw do i set it??

dont understand ...

cubby61
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Apr 05, 2009 2:00 pm

Re: Centre Banners in Joomla Banner Module

Postby cubby61 » Mon Jul 13, 2009 2:35 pm

I found this blog post that resolved this for me:

The solution to this problem is editing the file modules/mod_banners/tmpl/default.php : we need to tell Joomla to center each element.

You must edit this portion of the file

foreach($list as $item) :
?><div class=”banneritem<?php echo $params->get( ‘moduleclass_sfx’ ) ?>”><?php
echo modBannersHelper::renderBanner($params, $item);
?><div class=”clr”></div>
</div>
<?php endforeach; ?>

and we must add the <center> … </center> directive, thus having:

foreach($list as $item) :
?><center><div class=”banneritem<?php echo $params->get( ‘moduleclass_sfx’ ) ?>”><?php
echo modBannersHelper::renderBanner($params, $item);
?><div class=”clr”></div>
</div></center>
<?php endforeach; ?>

User avatar
dubjohnston
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Fri Aug 21, 2009 2:49 pm
Location: Melbourne, Australia
Contact:

Re: Centre Banners in Joomla Banner Module

Postby dubjohnston » Wed Jun 30, 2010 1:39 pm

Hi Cubby61,

Thanks. that worked a treat and took all of 1 minute.

cheers

dub

crashdown
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Jan 10, 2011 3:39 pm

Re: Centre Banners in Joomla Banner Module

Postby crashdown » Thu Jan 13, 2011 2:17 pm

Thank you Cubby61. Brilliant and well explained.

tappy52dog
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Sat Dec 17, 2011 7:45 pm

Re: Centre Banners in Joomla Banner Module

Postby tappy52dog » Sun Nov 25, 2012 9:40 pm

Hi, I really need help with this same issue, however the code seems to be different for Joomla 1.7. Can anyone help? I really need to center the banners for this module..

tappy52dog
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Sat Dec 17, 2011 7:45 pm

Re: Centre Banners in Joomla Banner Module

Postby tappy52dog » Wed Nov 28, 2012 6:59 pm

Okay, it seems that banner images (ie .gif files) that are uploaded in the banner component center fine in Joomla 1.7, however custom code (i.e. affiliate code) these banners seem to be stuck in left alignment. Anyone know how to fix this in Joomla 1.7 or 2.5?

tappy52dog
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Sat Dec 17, 2011 7:45 pm

Re: Centre Banners in Joomla Banner Module

Postby tappy52dog » Thu Feb 21, 2013 11:57 am

</center>

tappy52dog
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Sat Dec 17, 2011 7:45 pm

Re: Centre Banners in Joomla Banner Module

Postby tappy52dog » Thu Feb 21, 2013 12:06 pm

This is for everyone that is using Joomla 1.7 (this fix may also work for Joomla 2.5). This file path is the same at: modules/mod_banners/tmpl/default.php, however the code is a lot different from Joomla 1.5. I have no idea why, but adding the center tag after the banneritem line like this: <div class="banneritem"><center> is what fixed it for me :). I'm going to try in Joomla 2.5 too to see if it fixes it there too.

Note: I tried changing the CSS in my templates, but none of that made a difference. This was the only thing below that worked for me.

finally centered the banners for me..:). This line of code seems to be a lot longer in Joomla 1.7 as well. This is the code for Joomla 1.7 and the center tag locations that finally fixed this issue for me :) (note the change in center tag locations that I did on my site):

tappy52dog
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 115
Joined: Sat Dec 17, 2011 7:45 pm

Re: Centre Banners in Joomla Banner Module

Postby tappy52dog » Thu Feb 21, 2013 12:08 pm

For some reason it won't allow me to post the full code for this fix. I even tried using the code tags, but the joomla forum just gives me a forbidden error.. Hopefully the Joomla team can fix the forum, as I would be happy to share this fix.. :).

Jason_James
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri May 22, 2015 8:39 pm

Re: Centre Banners in Joomla Banner Module

Postby Jason_James » Fri May 22, 2015 8:41 pm

One line of code in your custom css worked for me.

.banneritem { text-align:center!important; }


Return to “Modules”

Who is online

Users browsing this forum: No registered users and 8 guests