Forum
if different="date"
How can I achieve that the date is only visible if the year has changed? Actually every article from this year shows 2015 using the following code. I think the problem is that the last before putting a new one already has the title 2015. It should then disappear from the second last. Here's my code:
<perch:if different="date" format="Y">
<p class="quote"><perch:content id="date" type="date" label="Jahr" format="Y" required="true" /></p>
</perch:if>
Many thanks!
That code should work. Is that the entire template?
Here is the entire template. The date is used a second time what shouldn't be a problem, right?
No, that shouldn't be a problem. Discounting the blocks, how many items do you have in the region?
So you have two items in the region, both from the same year?
Exactly, once only the year, once the whole date. The year should be visible only on top of all articles of the same year.
Are you getting it for both or for neither?
Every article with a date from the same year has on top the row with the year.
By every, you mean both? Because you have two items.
Sorry to be pedantic, but something about your language is making me think I don't have a clear picture of what is happening on this page.
No problem, I try to be clear! The hole region can be used as many times as necessary, let's say each is a (news)article. One article has e.g. an image, a date and text. Let's say there are 3 articles with a date from 2015. So on top of them should be 2015 as a title. Shall I send you the URL?
The URL would be helpful!
A region can only be used multiple times by adding it to the page multiple times:
I suspect you're talking about a multiple item region. In that case the date is compared with the last item in the region.
Right it is a multiple region. Here is the URL: https://www.schertenlaibundjegerlehner.ch/news-archiv.php
So your region currently has 4 items?
are totally 7 in the template.
In the admin. How many items have you added to this Region? So how many times have you completed the form to add an item?
Sorry! There are 4 items (2x 2015, 1x 2014, 1x 2008)
I can't see any reason why that shouldn't work.