This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have a placeholder in my layout:
{% placeholder page_header default %}
{% partial 'header' %}
{% endplaceholder %}
and in one of my pages (but not the others) I have
{% put page_header %}
{% partial 'header' product=1 %}
{% endput %}
Now in all the other pages (where there is no put
statement) the header doesn't display, but it does on the page where the put
statement is defined as above.
I was under the impression that the default
parameter meant that the contents between the tags would be displayed if no put
statement were defined.
I always thought that if you use the default
tag on a placeholder, the content inside was the "default" content for that placeholder, unless you replaced it in the put
tag with something else - but you still need to use the put
tag for the placeholder to work.
Looks pretty straightforward in the docs
Last updated
I had the impression (which I think is unclear in the docs) that the presence of a default
attribute on a placeholder then that would be displayed unless superseded by the use of a put
block. Apparently I was mistaken, in which case I will try to implement this in another way.
In the markup guide https://octobercms.com/docs/markup/tag-placeholder#default-placeholder-content it's said
If the
{% put %}
tag for a placeholder with default content is not defined on a page, the default placeholder content is displayed.
Maybe there is any way to enable this behaviour in layout and page? Imho, it could make placeholders really sweet feature, if we want lighter, less verbose pages, with maximum scaffold / defaults in the layout...
Added: I found if we do like this:
{% placeholder jsLibs default %}
{% default %}
<p>actual default content of placeholder...</p>
{% endplaceholder %}
it does the trick, and there is added <!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->
to the page source, in place of {% default %}
. I don't know whether it's an issue or I have to turn off some dev mode
Last updated
1-4 of 4