简体   繁体   中英

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!

您应该查找模板替代,是的,您可以在Joomla模板中重用css,js等资产。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM