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

Dynamic variables: PageInject Plugin or page.find

Started by Muut Archive 10 years ago · 1 replies · 408 views
10 years ago

Hi
Is there any way to use variables with [plugin:content-inject] or page.find(url)?

I.e.
{% include 'timetable.html.twig' with {'neededPage': page.find('/timetable/first')} %} - works just fine

but
{% set gymUrl = "/timetable/first" %}
{% include 'timetable.html.twig' with {'neededPage': page.find('#{gymUrl}')} %} - nope
{% include 'timetable.html.twig' with {'neededPage': page.find('{{ gymUrl }}' )} %} - nah

or (with twig processing(first) enabled,)
plugin:content-inject - works

but
{% set gymUrl = "/timetable/first" %}
[plugin:content-inject]({{ gymUrl }}) - no

10 years ago

Just a quick guess, but do you have to leave out the "{{ }}" around gymUrl?

TXT

{'neededPage': page.find( gymUrl )}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1354 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4065 9 years ago
Archive · by Muut Archive, 9 years ago
1 2953 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago