GT2000
GT2000

Reputation: 213

In a custom Joomla! template, how can I determine whether I am on the home page?

I am trying to create a custom template, but I want the template to look a little different for my Joomla! homepage/frontpage. Is there a easy boolean-type expression I can use to determine whether I am on my site's homepage?

That way, I can just say if ($on_homepage) { [custom homepage html] } else { [regular template] }

Thanks in advance!

Upvotes: 0

Views: 225

Answers (2)

Martin
Martin

Reputation: 10563

This is very easy, just create 2 templates. One for your homepage and one for the rest of your site. Then install both, make sure you give them a descriptive name in their xml file so you know the difference.

Once they are installed you can set a default template that would be site wide. Then choose/click on your homepage template and it's options will load up. On the bottom left you can select the menu items where this template will be visible. This setup is very much like the way in which you define where modules are shown.

Upvotes: 0

silvo
silvo

Reputation: 4009

You can create a separate template for your homepage. More details here.

Upvotes: 1

Related Questions