Posts Tagged ‘Joomla’

Joomla 1.5 center banner modules

Monday, June 8th, 2009

A common problem with Joomla 1.5 is centering banners placed in the left or on the right side.
We create a new banner from COMPONENTS -> BANNER , the banner is displayed but never centered.
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; ?>

Save the file and exit, it should work fine ;)

Joomla 1.5 - 500 Internal Server Error

Tuesday, April 28th, 2009

After installing Joomla on a Godaddy shared server (Deluxe plan which allow unlimited websites), I renamed htaccess.txt into .htaccess to allow url rewriting.

Home page is fine, but the first article created and linked to the main menu returned this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

The solution to the INTERNAL SERVER ERROR problem is uncommenting the following line in .htaccess (or in htaccess.txt if you didn’t already rename it).

# RewriteBase /

You must remove the # , thus having in your .htaccess

RewriteBase /

Reload the page and everything should be fine !

Upgrading Joomla 1.5 for multiple websites

Tuesday, April 14th, 2009

Upgrading joomla to the latest version is very easy

  1. Download the patch to the current stable version (joomla download page)
  2. Unpack the patch
  3. Upload the patch to your server overwriting old files

Few days ago Joomla has been updated to version 1.5.10 because of some security vulnerabilities.

Upgrading to Joomla 1.5.10 from Joomla 1.5.9 is straightforward, the required patch is 1.5.9 to 1.5.10 Upgrade Package

Upgrading Joomla 1.5 for multiple websites

My problem was upgrading 20 joomla installations automatically, not manually.

Each website has the Joomla SEO Patch, which has to be upgraded too, after the Joomla core upgrade.

I created a bash script to do everything automatically.

I use this directory structure for my websites: every domain is linked to a directory of my dedicated server, located in /var/www/websites

So I have

/var/www/websites/site1.com

/var/www/websites/site2.com

/var/www/websites/site20.com

I downloaded the 1.5.9 to 1.5.10 Upgrade Package to /root directory, I unpacked it using the command unzip Joomla_1.5.9_to_1.5.10-Stable-Patch_Package.zip in the directory /root/PATCH-1.5.9–1.5.10

I also downloaded the Joomla 1.5.10 SEO PATCH and unpacked it into the directory /root/PATCH-SEO

The script for a Joomla automatic upgrade is the following

cd /var/www/websites

for F in `ls -1`; do chattr +i $F/robots.txt; chattr +i $F/.htaccess; done

for D in `ls -1`; do cp -r /root/PATCH-1.5.9–1.5.10/* $D ; done

for D in `ls -1`; do cp -r /root/PATCH-SEO/* $D ; done

The first line changes your CWD (current working directory)

The second makes your robots.txt and .htacces immutable, thus avoiding overwriting.

The third line patches Joomla

The last line applies the Joomla Seo Patch

Have fun

BE CAREFUL, those commands worked for my dedicated server, your configuration and/or installation paths and versions will probably be different!!!

Joomla: “Error loading Modules”

Monday, December 15th, 2008

I’ve been playing with the generic and useless message generated by Joomla 1.5.8 : “Error loading Modules
This problem appeared while using Jumi, a Joomla plugin enabling custom scripts and file inclusion into articles, to include a php script which performs several sql queries.
I used Joomla + Jumi for a long time, without any problem. Now that I’ve moved from a Godaddy Shared Hosting to a Godaddy Virtual Dedicated Server, this problem has appeared.
What the hell was causing that weird message? And why no modules were showing in my page?
After wasting lot of time googling, I realized something with the MySql connection wasn’t fine.
I tried modifying all settings in my.cnf with no luck, I rewrote the script, I reinstalled Jumi… Nothing!
Before giving up, I looked into the php.net manuals.
HEY, FOUND THE PROBLEM!
Mysql has a “weird” behaviour: if you open 100 connections to 100 different databases in the same server, MySql uses the same connection id for each connection!
So if you do
$db1 = mysql_connect($host, $user, $pass);
$db2 = mysql_connect($host, $user, $pass);
mysql_select_db(’db1′, $db1);
mysql_select_db(’db2′, $db2);
you get a race condition: only db2 is selected.
That’s why my modules didn’t show !

What to do?
My workaround to fix the “multiple connections problem” with MySql is the following:
$host1 = “localhost”;
$host2 = “127.0.0.1″;
$host3 = “127.0.0.1:3306″;
$host4 = “localhost:3306″;
$db1 = mysql_connect($host1, $user, $pass);
$db2 = mysql_connect($host2, $user, $pass);
$db3 = mysql_connect($host3, $user, $pass);
$db4 = mysql_connect($host4, $user, $pass);

Hope it helps!
Any comment is welcome!