Search code examples
phpjoomlajoomla-template

Multiple templates in Joomla, parent assets folder


I'm fairly new to Joomla, altough I've build a lot of Wordpress sites. Now, I have a project where I have four sections, like: Homepage - Branches - Products - Partners. They all have a fairly similar but still different layout.

In Wordpress I can make pages like index.php, branches.php etc using custom post types, while still using the same css and js assets.

How can I accomplish this in Joomla? My idea was to make a head template where all the assets are stored. Then I would make three other templates for the other three sections, importing all the assets. Is that even possible? Or is there an other/better solution?

Any help is much appreciated!


Solution

  • In your templates' index.php you can just reference the common assets:

    <head>
        <jdoc:include type="head" />
        <link rel="stylesheet" href="<?php echo $this->baseurl ?>templates/common/css/style.css" type="text/css" />
        <link rel="stylesheet" href="<?php echo $this->baseurl ?>templates/this_template/css/style.css" type="text/css" />
    </head>
    

    Then, using Template styles, you can assign the templates to menu items.