3 min read

Using Flash headers

We have seen that one of the uses of Flash in Joomla! templates is as a header. By using a Flash animation in a site’s header you can create some stunning effects. As we have already seen, while designing the template, we may embed Flash animation in the header region and control the layout using an appropriate CSS stylesheet. To embed such Flash animations like these, you can use the <object> </object> XHTML tag. We have seen its use in the previous section. An alternative to this is showing the Flash header at some module position. There are several extensions that can be used for showing Flash objects at a module position. We will be looking at some of them next.

Using Flexheader3

Flexheader3 is a Joomla! 1.5-compatible extension for using Flash as headers in Joomla! sites. This is available for download for free at http://flexheader2.andrehotzler.de/en/download/folder/208-flexheader3.html. After downloading the package, install it from the Extensions | Install/Uninstall screen in Joomla! administration. Then click on Extensions | Module Manager. In the Module Manager screen, you will find the module named Flexheader3. Click on it and that shows the Module: [Edit] screen for the Flexheader3 module, as shown in the following screenshot:

Joomla! with Flash

The Details section is similar to other modules from where you enable the module, select the module position to display this, select the order of display, and assign menus for which this module will be displayed. The module-specific settings are in the Parameters section. As you see, selecting the module position is crucial for this module. Most of the templates don’t have a position to display the header using a module. Therefore, you may need to create a module position for displaying a Flash header. The following section shows you how to create a module position displaying a header.

Creating a module position

To create a module position in your template you need to edit at least two files. Browse to the /templates directory, and click on the name of the template that you want to modify. You need to edit two files in the template folder: index.php and templateDetails.xml. First, open the templateDetails.xml file in your text editor and find the <positions> tag. Under this, type the line highlighted in the following code so that the file looks like the following:

<positions> 
<position>flexheader</position>
<position>left</position>
<position>user1</position>
...
<position>right</position>
<position>debug</position>
</positions>

Remember to type <position>flexheader</position> before ending </positions> tag. Placing it outside the <positions> </positions> block will make the template unusable.

After modifying the templateDetails.xml file, open the index.php file in your text editor. Find out the code for including a header image in that template. Generally, this is done by inserting an image using the <img src=… /> tag. If you don’t find such a tag, then look for <div id=”header” … > or something like that. In such cases, CSS is used to display the background image to the div element.

Once you have found the code for showing the header image, replace it with the following code:

<jdoc:include type="modules" name="flexheader" style="RAW" />

This line of code means that you are instructing to include modules designated for the flexheader position. When we assign the Flexheader3 module to this position, the contents of that module will be displayed in this position. Generally, this module will produce a code like the following in this position:

<img src="/images/header.png" 
title="My header image"
alt="Header image"
style="width: 528px; height: 70px;"
/>

When changes to index.php are made, save those changes. We will be configuring the module to display a Flash header in this module position.

LEAVE A REPLY

Please enter your comment!
Please enter your name here