Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Modular containing same module multiple times

Started by Muut Archive 10 years ago · 5 replies · 452 views
10 years ago

Hello,

I'm building a single page site and want to include a module (_contact) multiple times. is there a way to achieve this?

Tried the following (modular.md)

YAML
content:
  items: '@self.modular'
  order:
    dir: asc
    by: default
    custom:
      - _showcase
      - _in-page-navigation
      - _steps
      - _contact
      - _prices
      - _examples
      - _contact

Thanks in advance

Thorsten

10 years ago

One way to to do this is to create a page/template somewhere and set the page for content in the template, that way you can simply include the template on any page, (modular or not) and it will render with the right content.

If the contact modular page is basically a form, you are able to access any form on any page, just include the appropriate twig template. See this: https://learn.getgrav.org/forms/forms#displaying-forms-from-twig

10 years ago

Do you mean a PHP include in the modular template?

10 years ago

it's a twig include, the link he provided shows it clearly

10 years ago

The manual states:
Twig processing as well as page cache should be disabled to ensure the form is dynamically processed on the page and not statically cached and form handling can occur.

YAML
title: Page with Forms
process:
  twig: true <-- typo?&quest;
cache_enable: false

Is this a typo?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago