|
|
Want to know more about Packt's Article Network? Interested in contributing your article ideas? Please visit our FAQ for more information. See More BROWSE
All Titles WordPress Web Services SOA BPEL Web Graphics & Video Web Development RAW Portugues, Espanol, Italiano, French PHP/MySQL Oracle Open Source Networking & Telephony Moodle Microsoft & .NET Linux Servers jQuery Joomla! JBoss Java e-Learning e-Commerce Dynamics Drupal CRM Cookbook Content Management Beginner Guides Architecture and Analysis AJAX Future Titles Recently Published Titles There are many possibilities of using Flash in a Joomla! website. In this article by Suhreed Sarkar, we will get familiar with how to use the YOS amMap extension to display interactive maps on your Joomla! website. See More |
Joomla! with Flash: Flashy Templates, Headers, Banners, and Tickers: Part 1
In this article, we will mainly focus on the visual design of our site. To acquire the information presented here, it is assumed that you have some basic understanding of Joomla!'s visual design including templates, components, module position, and so on. Adding Flash in templatesIf you are familiar with Joomla! templates, then you will understand that there are two ways to display Flash in a template:
We have seen many modules that can display Flash objects. Therefore, in this section, we will be looking into the embedding of Flash objects within templates. It will also be helpful if we understand the structure of Joomla! templates. Generally templates for Joomla! include headers in Flash. Flash animations are included in the header area of a Joomla! template. Some templates include the mechanism to show images from a specific directory. For example, the template shown in the following screenshot, available for download at http://joomlatp.com/joomla-1.5-templates/Templates-has-flash-header.html, is designed to show a Flash header comprised of the images kept in a directory:
The following sections briefly describe the structure of a Joomla! template and the ways to embed a Flash object in this template. Structure of a Joomla! templateThe look and feel of Joomla! is determined by templates. You can apply a template to the frontend as well as to the backend. Templates for the Joomla! frontend reside in the /templates directory of the Joomla! webroot, while those for the administration panel are found in the /administrator/templates directory. You can install multiple templates and apply one or more templates to the different sections. However, you must designate one default template for the site. To designate a default template, go to Extensions | Template Manager. Select the desired template and click on the Default button on the toolbar. For assigning a template to a specific section of the site, click on a template, except the default template, and then select the section or the menu item for which you want to assign the template from the Menu Assignment section. If you examine the directory structure of a Joomla! template, you will find at least the following subdirectories in the templates directory:
Joomla! with Flash
As you know, the main structure of a Joomla! template is defined in the index.php file. The file looks as follows: <?php This line of code is to prevent direct access to the file. This is a convention to prevent direct access to any file in Joomla!. After this, the following lines define some variables for the template that will be used later on in the template: define( 'YOURBASEPATH', dirname(__FILE__) ); Having defined the template variables, the template's structure starts with some common HTML declarations as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Whatever is included after the following lines will be considered as included in the <head> section. Generally, stylesheets, JavaScript, and site-wide files are included in a template's <head> section with the following lines: <jdoc:include type="head" /> Next, the body section of the template starts: <body class="body_bg"> The following block checks whether any module for position user4 is enabled. If the count of enabled modules is greater than zero, then a <div>element with an ID search is displayed, and modules specified for position user4 are displayed as children of this <div> element: <?php if($this->countModules('user4')) : ?> Having placed the modules for the position user4, the following block now defines where to show the site's logo. This block of code dynamically selects the site's logo and links that to the site's home page: <!-- BEGIN: LOGO --> If we want to show a Flash header beside the logo, then we can add the following block to include a Flash object: <!-- BEGIN: flashheader --> This code block first checks whether the variable for showing a Flash header is checked or not. If it is checked, then a <div> element will be created, under which the Flash object is embedded using the <object> </object> tags. The following code block is used to display the current date on the site: <!-- BEGIN: Date --> The following block defines another module position. Modules designated for the user3 position will be displayed here. Note that modules are included with the <jdoc:include type="modules" name="position-name" /> markup: <?php if( $this->countModules('user3') ) {?> The following code block displays another module called breadcrumbs. First, it checks whether the parameter is set to show breadcrumbs or not. If it is, then the breadcrumbs module will be displayed in the block: <!--pathway start--> Next comes the module for the left position: <div id="content"> The following block includes the modules designated for the right position: <?php if($this->countModules('right') andThe next code block counts the number of modules available for the user1 and user2 positions and then includes the modules designated for these two positions. Note the highlighted line of code in this code block. It shows the component currently selected: <!-- BEGIN: USERS TEMPSPLASH --> Finally, here comes the footer section. The highlighted line in the following code block includes a footer file to show the footer text: <!--footer start--> All this code in the index.php file when rendered with template_css.css and other stylesheets will display a layout like the one shown in the following screenshot:
In a Joomla! template, the site's data comes from the database and fits in different positions. When you are planning for Flash-based Joomla! templates, you should first identify where to put the Flash objects and where to display the dynamic data for the site. In the template layout, we have seen that a suitable place for adding a Flash object are the logo and the header positions. We can also use some extensions to display Flash headers. The following sections explain how to use extensions for showing Flash logos and headers. Using Flash logosYou can replace the ordinary image with Flash-animated logos by embedding it in that position. As we have seen earlier, Flash objects are embedded in Joomla! templates using the <object> </object>XHTML element. For styling purposes, you may put this element under a <div> element, as shown in the following code: <div id="logo"> As you can see, the <object> </object> tag can contain child elements. We pass parameters to the Flash objects using the <param> element. For example, we have passed the name of a movie file using the highlighted tag in the previous code. Some of you may already know about the SWFObject JavaScript library. It is used to embed Flash files using JavaScript. You can also use it to embed Flash objects in Joomla! and can also generate Flash objects. It is freely available at http://code.google.com/p/swfobject/. Brief documentation on its usage is also available there. >> Continue Reading: Joomla! with Flash—Flashy Templates, Headers, Banners, and Tickers: Part2 If you have read this article you may be interested to view :
Joomla! with Flash
About the AuthorSuhreed Sarkar—IT consultant, trainer, and technical writer—studied Marine Engineering, served on board a ship for two years, then switched to the computer world with MCSE in Windows NT 4.0 track late in 2000. His latest field of study is business management and he has earned an MBA from the University of Dhaka. He has a bunch of BrainBench certifications including PHP4, Project Management, RDBMS Concepts, E-Commerce, Web Server Administration, Internet Security, Training Development, Delivery and Evaluation, and Technical Writing. As a trainer, he has taught courses on web design, development, and e-commerce. He also delivers lectures on MIS and e-business in public and private universities in Bangladesh. Being passionate about learning and teaching new skills, he prefers hacking and teaching to actual coding for clients. As a consultant and trainer he has experience consulting for some international organizations including the United Nations, where he helped clients building and adopting their enterprise portals, large scale databases, and management information systems. He is the best-selling technical author in Bengali—having a dozen books published on topics covering web development, LAMP, networking, and system administration. As an open-source enthusiast, he is active in different forums and takes every chance to promote open-source CMSs and shopping carts including Joomla, Mambo, Moodle, WordPress, osCommerce, Zen Cart, etc. While not busy with hacking some apps, blogging on his blog (blog.suhreedsarkar.com), reading the philosophy of Bertrand Russell or the management thought of Peter F Drucker—he likes to spend some special moments with his family—wife, son, and daughter. Suhreed lives in Dhaka, Bangladesh with his family and may be reached at suhreedsarkar@gmail.com. Books from Packt
|
|
| ||||||||