Customize front page of your website [Joomla]

For Customizing joomla front page, there are so many methods and modules for customizing home page with your articles layout. But below code works at module level where you want to display some module only on front page, not other pages and some module display only on other pages except front page then this code is useful.

You can write the code given below in index.php in your template folder where you want to put module on front page, put below condition with your HTML code in index.php file.

Here i have shown two methods. Both are working well.
1.

//HTML code
<?php
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
?>
//HTML Code – YOUR HOME PAGE CODE
<?php    
}
else
{
?>
//HTML Code – YOUR OTHER PAGES CODE
<?php } ?>

2. This method works front-page component.

<?php 
if ($view=='frontpage') 
{
//HTML Code – YOUR HOME PAGE CODE
}
Else
{
?>
//HTML Code – YOUR OTHERS PAGE CODE
<?php    
} 
?>

Speak Your Mind

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: