How to specify a home page layout and an article page layout in joomla?

I have two layouts, one for the home page and one for article pages.  I have a custom template built and saved as index.php in joomla for the home page, but how do I specify another layout for article pages?
LVL 14
Who is Participating?
joomla_phpConnect With a Mentor Commented:
It should be the same in 16 as it is in 15, if not report back here

install both templates, each having a distinct name

Under extensions, templates,
click template1, assign it to the home page, save
click template2, assign it to all other pages, save
Panagiotis SConnect With a Mentor web developer - designer Commented:
1. Create homepage conditionals in Joomla!, or create the ability to target the default menu item.

Sometimes it's necessary to specify styling or some functionality that is specific to the front page. Joomla! provides a few different ways to do this. One of them is to place a check for the front page in the template code.

1.// Detecting Home
2.$menu = & JSite::getMenu();
3.if ($menu->getActive() == $menu->getDefault()) {
4.$siteHome = 1;
6.$siteHome = 0;

In this snippet, we're grabbing the menu in the $menu variable, then checking if this menu item is the active menu item and if it's the default. We're then setting a variable $siteHome with a boolean value (1 or 0) i.e. whether the variable returns a true or false value.

Now you can place a simple conditional around any html element in the page:

1.<?php if($siteHome) { ?>
2.<div id="home-banner">
3.This content will only show on the homepage!
5.<?php } ?>

from joomla magazine
EMB01Author Commented:
Okay, so I have two options:  1.  add conditionals to the template.  2.  create another template all together.

One small, additional question:  How do I echo the meta description in my template?  For instance:

<h1><?php echo_joomla_title(); ?></h1>
<h2><?php echo_joomla_meta_description(); ?></h2>
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

The meta description is output via the use of

<jdoc:include type="head" />
EMB01Author Commented:
That sounds like it outputs more than just the description.  Is there anyway to get just the description?  Or, is it impossible?
echo ($this->getMetaData('keywords'));
echo ($this->getMetaData('description'));
Panagiotis SConnect With a Mentor web developer - designer Commented:
the easiest method is the one with the simple conditions.

The only need is to have some additional css classes for the home page

EMB01Author Commented:
I think I would like to create two different templates, rather than using conditionals.  Thanks for the extra info.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.