betweenbrain™ | web • print • idenity • creative

  • Content
  • Navigation
  • Home
  • Services
  • Process
  • Contact
  • About
  • Notes
  • Download

Component Only Template

Last Updated on Tuesday, 27 July 2010 21:13

The power and flexibility of Joomla allows for the creative use of template techniques to expand its capabilities. One such technique is the use of a component only template. It expands the possibilities of a Joomla website by providing the ability to include content such as splash pages, full-screen Flash movies, and even pseudo 404 pages for hiding a website from a casual passerby. The following tutorial will show you how to implement a component only template.

To give you an idea of what can be accomplished with a component only template, we have put together the following demos. Each one is an article contained in this website. The only difference is the template.

Demo: Pseudo 404 Not Found

Demo: Loading Page

Demo: Flash Map

A component only template is exactly as the name implies, only the component. No module positions or other elements are included in this type of template. This allows for the possibility to exclusively display the content of an article.

Index.php of a component only template is equally simple:

<?php defined( '_JEXEC' ) or die( 'Restricted access' );?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>">
<head>
<jdoc:include type="head" />
<link rel="" type="text/css" media="screen" href="/<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/screen.css" />
</head>
<body>
<jdoc:include type="component" />
</body>
</html>

In the template, we have included a stylesheet, although it may not be needed in all cases. There isn't much more to the template other than a basic templateDetails.xml for the installation of the template, the obligatory blank index.html files to keep pesky eye's out of our business, and a single override that strips the article layout down to it's core:

?php defined('_JEXEC') or die('Restricted access'); ?>
<?php echo JFilterOutput::ampReplace($this->article->text); ?>

Feel free to make your own version or download the component only template.

The template is installed like any other: From Joomla's Administrator interface, select Extensions -> Install/Uninstall .Browse to your template file, select it, then click Upload File & Install. When complete, we'll move onto creating an example splash page.

In this example, we'll be using the flash map, displayed in the third example, as a splash page for our website. Simply create a new article, assign its respective section and category, and insert the flash file like any other. 

Since templates are assigned on a menu basis, we'll need to create a menu item to display the article we just created. And, since this will be a splash page, we'll need to set it as the default menu item. But, we don't want the menu itself to be visible on the site. Not a problem, simply create a new menu in the menu manager by going to Menus -> Menu Manager:


Click the New button in the upper right-hand corer


Enter "Hidden" for the Unique Name, Title, and Description. Leave the Module Title box empty.

Now, we can create our menu item for our new splash page. Go to Menus->Hidden to enter the menu manager for our new menu. Click on the New icon to create our new menu item.


Since we're creating a single article layout, select Internal Link -> Article Layout


Then, select the article we just created from Article Select in the Basic Parameters of the new menu item.

You will be returned to the Menu Item Manager for the Hidden menu. Check the box next the menu item you just created, and click the Default icon in the toolbar to set this item as your new homepage.

 

Now, all we need to do is head to the Template Manager, by selecting Extensions->Template Manager from the menu.

First, make sure that the Template that you want to use for the rest of your site is set as the default. Then, click on the component only template name to edit its menu assignment.

Click on the Select from List radio button and select the menu item you just created. Click the save icon in the toolbar and your done.

 

You have now assigned a component only template to the article which contains your splash page flash animation. Since that article is set to be displayed as the default menu item, the flash animation will be will be the first, and only thing, a visitor sees when going to the root of your site.

Update May 21st 2010 A big thanks goes out to Peter van Westen (a.k.a. NoNumber!) for reporting the need to add

<jdoc:include type="head" />
to support certain extensions, such as his Articles Anywhere. Thanks Peter!

Comments  

 
+1 #8 Matt 2010-05-18 07:31
Quoting Simon W:
I've looked around for a joomla splash page and it all seemed complicated to me as joomla noob until I tried this today. So far it seems perfect - easy to install and just works. Thanks for sharing it and writing such a good tutorial - that really helps.
Cheers

Hi Simon,

That's fantastic to hear. I really appreciate the feedback. I'm actually in the process of developing a new site to support a complete template framework that will have features like this (and many other cool tricks). It also takes this kind of approach. You can sign up for news about this at http://joomlaengineering.com.

Thanks again!

Matt
Quote
 
 
+1 #7 Simon W 2010-05-18 07:27
I've looked around for a joomla splash page and it all seemed complicated to me as joomla noob until I tried this today. So far it seems perfect - easy to install and just works. Thanks for sharing it and writing such a good tutorial - that really helps.
Cheers
Quote
 
 
0 #6 Matt 2010-04-08 08:44
Quoting Joop:
This is the best tut of making a flash intro!
I have only one question?
I'm a new to joomla, an i don't now wich page i have to use to go from my flash intro to my second homepage.

I don't know if you can help me out, but thanks anyway from NL

Hi Joop,

Thanks for the great comment, I appreciate the feedback. This tutorial was made in response to a forum post at http://forum.joomla.org/viewtopic.php?f=470&t=444769 . Can you make a post there and we'll jump in and help you.

Best,

Matt
Quote
 
 
0 #5 Joop 2010-04-08 08:36
This is the best tut of making a flash intro!
I have only one question?
I'm a new to joomla, an i don't now wich page i have to use to go from my flash intro to my second homepage.

I don't know if you can help me out, but thanks anyway from NL
Quote
 
 
0 #4 Rick 2010-02-25 23:08
This code was a lifesaver. Thanks so much!!
Quote
 
 
+1 #3 Matt 2009-12-29 09:34
Quoting eric:
I am happy to see some people care enough to spend time to make these cool tutorials. I have been looking for a long time to find a solution and tried many suggestions. This works well and will help many others!

Thanks.

Hi Eric,

Thanks for the kind words. Without community support, Joomla wouldn't exist. Writing these tutorial is the least we can do to give back to those that gave so much to develop and support it.

In fact, we're working hard on developing a new learning tool for the Joomla community. We hope to have it released in the next few months. Keep an eye out!

Best,

Matt
Quote
 
 
+1 #2 eric 2009-12-29 06:32
I am happy to see some people care enough to spend time to make these cool tutorials. I have been looking for a long time to find a solution and tried many suggestions. This works well and will help many others!

Thanks.
Quote
 
 
0 #1 Rigsby 2009-12-21 09:51
Awesome, thanks! This is exactly what I was looking for. It's too hard to make an external index.html landing page work along side of joomla. This is much easier and quicker.
Quote
 
Refresh comments list
RSS feed for comments to this post

Add comment

We'd like to hear what you think. As long as it's constructive, we'll publish it.


Security code
Refresh

Send
Cancel
JComments
Going up?
feed-image Feed Entries
  • Home
  • Services
  • Process
  • Contact
  • About
  • Notes
  • Download
  • Search
  • Sitemap

All rights reserved. © 2010 betweenbrain™
Developed using the Joomla Engineering™ Template Development Framework
Disclaimer