This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Ok, so I have a static page layout with the following 2 lines at the top, right after the ==
{variable name="tagline" label="Tagline" tab="Header" type="text"}{/variable}
{variable name="banner" label="Banner" tab="Header" type="mediafinder" mode="image"}{/variable}
These are working fine. I get a tab called "Header" in the static pages plugin and I can do {{ banner }}
and {{ tagline }}
and have the content appear.
However, I also want to do this:
{repeater name="panels" prompt="Add another panel" tab="Panels"}
{mediafinder name="icon" label="Icon" type="mediafinder" mode="image"}{/mediafinder}
{text name="panel_title" label="Title"}Title{/text}
{text name="panel_name" label="Name"}Name{/text}
{textarea name="panel_content" label="Content"}Content{/textarea}
{/repeater}
I get the "Panels" tab as expected, but the problem is that the page spitting out all of the content at the top of my HTML document.
Aside from that, it is working how I want it to. I can put on a page which contains a {% for %}
loop to display the data.
Just relalized my mistake... the repeater items are supposed to be variable
too, and the data type set with a type=
like this:
{repeater name="panels" prompt="Add another panel" tab="Panels"}
{variable type="mediafinder" name="icon" label="Icon" type="mediafinder" mode="image"}{/variable}
{variable type="text" name="panel_title" label="Title"}Title{/variable}
{variable type="text" name="panel_name" label="Name"}Name{/variable}
{variable type="textarea" name="panel_content" label="Content"}Content{/variable}
{/repeater}
joseph.d said:
Just relalized my mistake... the repeater items are supposed to be
variable
too, and the data type set with atype=
like this:{repeater name="panels" prompt="Add another panel" tab="Panels"} {variable type="mediafinder" name="icon" label="Icon" type="mediafinder" mode="image"}{/variable} {variable type="text" name="panel_title" label="Title"}Title{/variable} {variable type="text" name="panel_name" label="Name"}Name{/variable} {variable type="textarea" name="panel_content" label="Content"}Content{/variable} {/repeater}
I try to display Variables of repeater on a partial using {% for %} loop but nothing is shown. If i use only variables without repeater i can display them on partials without problem. Is there a way to display repeater variables on partials?
Last updated
Hey, you can use {{ dump() }} in page to see what variables you can access there.
you named your repeater name="panels" so i guess in you page you can use panels variable which contains array of items each item will be your details which you used for repetition.
{% for fields in panels %}
<h2>{{ fields.panel_title }}</h2>
....
{% endfor %}
if you find any other issue please comment.
1-4 of 4