This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

digitalkultur
digitalkultur

Hi community,

since the latest update the check for a placeholder doesnt work anymore in context with the static pages plugin (http://octobercms.com/plugin/rainlab-pages). If i try something like this (in a layout template):

{% if placeholder('my_placeholder') %}
    {% my_placeholder %}
{% else %}
    <!-- do something else -->
{% endif %}

the if-condition always returns true regardless of whether the related tab within the "Edit Static Page"-Screen has content or not.

I followed the documentation (https://octobercms.com/docs/markup/tag-placeholder, Checking a placeholder exists) and before updating it still works. I already reinstalled october and all dependent plugins in the latest version but with no luck.

I want to ask if anyone can reproduce the problem and confirm to determine if this is a bug.

Thanks in advance! Kindest, Markus

Verbat
Verbat

I used the same technique in some of my pages and I noticed that it works only if you're editing the file on your hard drive itself.

If you check the local file on your drive there must be somthing like this:

==
{% put my_placeholder %}
Your Placeholder content
{% endput %}
==

If you using the octobercms editor and remove the placeholder content it just removes the content but leaves the placeholder tags like below.

==
{% put my_placeholder %}

{% endput %}
==

So i think that's the reason it always returns true but I'm not that of an octobercms specialist. If you go directly to the local file and remove the whole put section it should work. At least it does for me.

Last updated

digitalkultur
digitalkultur

Hey Verbat, thanks a lot for the explanation! I'll look into it but i´m sure it still worked up to build 346 or 347 where the condition returned false when placeholder editor was empty what makes sense. Just take a look ...

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.