Hot answers tagged

6

Thought I would add this as an answer instead as it should solve your issue. I think the issue with writing it like batch('{{ nr }}') is that twig sees whatever is in '' as a string, so is seeing {{ nr }} as it is. You also don't need to echo a variable as a function parameter i.e batch({{ nr }}), you just need to reference the variable itself. So by just ...


4

To my understanding this should work for a matrix field (called imageLinkBoxes) that contains only one type of block (imageLinkBox) that has 3 fields (imageLinkBox.linkText, imageLinkBox.linkUrl and imageLinkBox.text) {% set aboutInfo = entry.imageLinkBoxes %} {# get all the blocks in the matrix #} {% if aboutInfo|length %} {# check we have at least one ...


3

Without understanding your use case or having the context of your full template and/or Matrix loop, it's very difficult to provide a good answer. If you only want to "wrap all outputted blocks" in a container, it's as easy as putting the Matrix loop in a container, e.g.: <div class="wrapper"> {% for block in entry.myMatrixFieldHandle %} {%...


1

Ok, update.. The problem of my high memory usage was caused by (I think the logging of) devmode.. When I set devmode to false the moment that hit 10+gig memory before now has 100mb of memory usage... Resetting memory on the different tasks that get initiated in the same function or as subtasks is not possible I guess?


1

I don't think you can test a conditional against a batch set like this. I think it's testing each batched set against the conditional instead of each item inside the batched sets which is what you're going for. I would just create a new set of filtered matrix blocks and then batch the result. {% set onlyHalfWidthBlocks = [] %} {% for block in entry....


1

I think I got it. Here's what I did: {% for entry in items|batch(10) %} <div class="set"> {% for batch in entry[0:3] %} {% if loop.index == 1 %} <div class="rowOne"> <div class="big">{{batch}}</div> {% elseif loop.index == 2 %} <div class="big-top">{{batch}}</div> {%...


1

If you just want to affect the artworkFile blocks, you could do this: {% case "artworkFile" %} {% for asset in block.downloadUrl %} {% if loop.first %}<div class="wrapper">{% endif %} <a href="{{ asset.getUrl() }}" target="_blank"> <div class="file {{ block.platform }} gutter-bottom--half"></div></a> {% if loop....


1

It was a php.ini config problem, I put some parameters values up and the update succeeded in less than 2 minutes and completed my users batch update. So you just need to update the values below and reload your web server (ie: Apache). max_execution_time 120 (instead of initial value 30) memory_limit 512M (instead of initial value 128M)


Only top voted, non community-wiki answers of a minimum length are eligible