Saturday, February 7, 2009

Switch off Joomla Statistics, switch on search stats

This article applies to Joomla 1.0 only

The default Joomla statistics (and other statistics components) capture a lot of mostly useless data, might cause your database to grow and then degrade the performance of your website.

The data gathered by these components is mostly insignificant anyway. On the other hand, it is strongly recommended to switch on only your search strings statistics, because knowing what people are searching for on your site is quite useful and gives you insight on what your users need when they come to your website.

Statistics are defined in Site > Global Configuration > Statistics tab

Statistics: No

Log Content Hits by Date: No

Log Search Strings: Yes

If you think you require these kinds of statistics, rather than storing this information in your database, use Google Analytics rather than clutter your database Wink

Optimize the default search options

By default the Joomla search searches for any word. That is if you look for "Joomla components", you will find any page which contains either Joomla or components. People require AND search. The following hack to the core code will enable all words searching by default.

In /components/com_search/search.html.php:

Find: $searchphrase = strtolower( strval( mosGetParam( $_REQUEST, 'searchphrase', 'any' ) ) );
Change to: $searchphrase = strtolower( strval( mosGetParam( $_REQUEST, 'searchphrase', 'all' ) ) );
This occurs twice in approximaletely lines 126 and 215

Also, in /components/com_search/search.php:

Find: $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'any' );

Change to: $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'all' );
This occurs in approximately line 103


Rememer to make a backup of each files in case something goes wrong.

Use Joomap and Google Sitemaps

Joomap coupled with Google Webmaster Tools is the sure way of getting your site's content in the Google index as soon as possible.

Sitemaps are the newest way of submitting content to search engines. There are several ways of creating sitemaps, however since Joomla contains dynamically changing content, you want your sitemap to be updated constantly to update your current content.

Joomap allows you to create a dynamic sitemap, always staying current with any changes in your content. Thus instead of waiting for the GoogleBot to index your content, using a sitemap, you are ensuring that all your content is being indexed as soon as the Google crawler accesses your sitemap url.

Therefore, if you still haven't done this, create a Google Webmaster account, verify your website, and submit the url created by Joomap as a sitemap.

Joomla not working?

This is quite a vague statement, and there is a multitude of reasons why this could be happening. However, the following might eliminate one of the reasons why a Joomla site is not working, i.e. corruption of files during upload.

Have you recently installed or uploaded your site to the web server and it is not working? Is your site acting strangely or funnily, or you have blank pages coming up in certain areas? This is usually a problem with having corrupt / missing files in the installation. The best way to check for this is to use the Joomla Diagnostics tool to check whether and files are missing or corrupt during installation.

Image

The tool consists of two files which you upload to the root of your Joomla installation. You then access the http://www.yourdomain.com/diagnostics.php file and this will give show you whether any files are missing or corrupt. You can then replace any missing files using an FTP client, or JoomlaXplorer.

Turn off TinyMCE Cleanup Code

TinyMCE, the default WYSIWYG editor in Joomla, is set to strip away "unsafe" HTML tags in order to protect you from certain exploits. This article shows you how to switch this off to be able to insert srcipt tags.

A safety feature of the TinyMCE WYSIWYG editor is the stripping off of certain html codes such as . Sometimes though you need to be free to insert these codes at will. To switch the safety feature off you need to turn this off from the Mambot parameters:
  • Mambots > Site Mambots
  • Click on TinyMCE Editor
  • Turn off the Code Cleanup parameter.

N.B. Switching off this protection exposes you to significant security risks. DO NOT switch this off, if you have enabled components which allow users to submit content via TinyMCE because they would be able to insert exploits into the content.