S
S
Sergey Pasternak2021-06-17 12:57:02
OctoberCMS
Sergey Pasternak, 2021-06-17 12:57:02

How to display individual blog posts through different templates in October (Winter CMS)?

Hello. There was a need for certain records to make a separate template for displaying the content of the post. Can you please tell me the best way to organize this?
Rainlab Blog module

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2021-06-17
@Adamos

Twig allows you to pull up one or another piece of the template according to the condition. Like this:

{% if current is defined %}
    {% partial __SELF__ ~ '::page' %}
{% else %}
    {% partial __SELF__ ~ '::list' %}
{% endif %}

Accordingly, you make two templates, and connect the third one to the page, in which it is determined which of the two to use for specific data (in the example, the one specified in the component is checked ) $this->page['current']

A
Alexander, 2021-12-24
@alexTitakoff

You can define the type of post in the template, for example, by category. Then render the desired scab, with the desired design. Scraps are needed so as not to overload the blog page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question