S
S
Skrolea2017-04-13 11:04:13
1C-Bitrix
Skrolea, 2017-04-13 11:04:13

How to make different templates in Bitrix?

There are two templates - for the main and internal pages
In the list of sites I specify index.php according to the condition and for all the others - everything is fine.
But in the template for the main page, my code goes like this

<body>
<header></header>
<section class="очень хочу"></section>
#WORK_AREA#

</body>
, and in the second (for internal)
<body>
<header></header>
<main>
#WORK_AREA#
</main>
<aside></aside>
</body>
+ in my main styles, I should have a different indent.
If you create two templates, then it turns out that you need to duplicate all the styles? In the first one (for the main one), I wrote everything in template_style.css, in the second one, do I have to repeat them all? well, except for my main. How does it work in Bitrix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2017-04-14
@Skrolea

2 templates = 2 copies of the header, footer, style, ... files.
This is completely solved by moving the styles to a separate directory.
For example (folder structure):

- templates
  - .default
    - css
      - common.css
  - front-page
    - header.php
    - footer.php
    - template_styles.css
  - other
    - header.php
    - footer.php
    - template_styles.css

And load common styles in header using `AssetManager`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question