Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [blocks]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

Matrix Block query next prev

Good afternoon, Is it possible to have a next prev button to cycle through a number of matrix blocks within a single entry and show the blocks content individually on screen? The block contains an ...
2
votes
1answer
106 views

Nesting block tags doesnt work

I have pagination twig component that needs to inject seo links into of page (rel canonical). I tried to use {% block %} twig tag for this, but problem is that pagination component is already ...
1
vote
0answers
44 views

SuperSort Matrix Block sort by Year / Month / Now Data

{% set allCVs = entry.profileCv.all() %} {% set cvEntries = [] %} {% for item in allCVs %} {% set fromMonth = item.fromMonth.value %} {% set fromYear = item.fromYear %} ...
1
vote
1answer
110 views

How to handle client expectations regarding page building and layout within Craft

I love Craft CMS and use it for nearly every site I build. There isn't a better tool (in my opinion) for managing custom data. And using a matrix field as content builder solves the majority of my ...
1
vote
1answer
478 views

Using a variable that was set in a previous include

By base.html: {% block searchLogic %} {% endblock %} {% block meetingDisplay %} {% endblock %} My index.html: {% extends "base.html" %} {% block ...
1
vote
1answer
52 views

Exclude a block from appearing on a specific page

I'm currently trying to make my navigation be not included on my index page due to my loading a different style of page - but - include it on every other page. My current layout looks like so: ...
1
vote
1answer
55 views

Include user information in html block

I need to pass the logged-in user's email address as a variable to a embedded javascript form. I think the easiest way for me to do this is to dynamically embed the user's email address in the embed ...
2
votes
2answers
198 views

How to pull the first block of its kind from a Matrix?

This is a news feed with a title, image and short blurb beneath. The entry content is built with the Matrix. An entry can be made up of a single 'textEditorBlock' or multiple 'textEditorBlock'. I ...
1
vote
1answer
256 views

Counting included child blocks in the Neo plugin

In the Neo plugin, I've made a block that has the option to add 3 child blocks underneath it. This is the code from the parent block: {% extends 'neo/default' %} {% block blockContent %} <...
2
votes
1answer
296 views

Display text field from Matrix of an Entry Field in Matrix

Question is similar to some others I've looked through but their solutions don't work as there are some differences. Currently this doesn't output any of the fields I try to access within the ...
3
votes
1answer
3k views

Can I use a Block inside an Include file?

I have a _layout.html template which has both an include partial {% include '_partials/_header.html' %} and a block section (e.g. Content) for other templates to extend it. Can I put another block ...
3
votes
1answer
94 views

Migrating Content from ExpressionEngine that used Matrix Image haystack Technique

So I'm taking the plunge from ExpressionEngine to Craft! I have a ton of entries I need to move over, though - and I used the "matrix image haystack" technique for my blog posts to inject the images ...
1
vote
2answers
334 views

Matrix entry causing last bootstrap column to be shunted down

I have a Matrix field which has one block type (1 asset field - I'm using a Matrix field as I'll be adding text fields later on to the same block). On the front end I am using Bootstrap's grid system ...
2
votes
2answers
1k views

Send a block… into a block?

I'm fiddling around with Twig and CraftCMS, trying to create a component-based structure... of sorts. All good so far, except this one thing I got stuck on. Here's an excerpt from my main layout: &...
1
vote
1answer
84 views

Unable to sort large number of blocks in Matrix field in CP and template

I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save ...
7
votes
4answers
3k views

Templating Matrix Block

It's my first website using Craft. I'm trying to figure out how to loop Matrix. I have created a field called bannerMatrix with a block type called banner that has 3 fields: Image (assets) Heading (...
-5
votes
1answer
841 views

How to create custom blocks

We would like to create custom blocks. Is it possible to create custom blocks? if yes, do you have a good tutorial?
3
votes
1answer
618 views

group Matrix blocks and also order by Matrix field for a given block

I'm wondering if I might have a little too much inception madness in my thinking with this problem. Enhancing a site we built for a conference last year. As there's an annual conference each year and ...
1
vote
1answer
62 views

Is it possible to combine information from two blocks from a matrix to an if function?

I have a check box field called requiredPrograms, in it it has a selection of programs you can choose from. This is within a matrix field called Work shop Instructor which is for my workshop channel. ...
0
votes
1answer
5k views

Passing variable from block within including template

I have this situation, where variable param doesn't exist. skeleton.twig {# Inject template #} {% block var %}{% endblock %} {% include '_includes/template' %} Now I want to extends index.twig ...
2
votes
2answers
673 views

Matrix max block type limit

Currently it's possible to set a max block value for the collection of block types. However I have a case where it would be great if I could set block type limit. For example I have a situation ...
3
votes
2answers
516 views

How do I output a file’s URL in a Matrix field?

I have a Matrix field with Image, Caption, and PDF sub-fields. I can output the Image and Caption fine, but am having no luck with the PDF file. Here is the code: {% for block in entry....
3
votes
3answers
900 views

How can I get the last Matrix block of a certain type?

I have a Matrix field with some different block types; images, videos, text, etc. When I loop over the blocks I have some extra code (facebook and twitter sharing, back-button, etc) that should only ...
8
votes
2answers
24k views

Is there a way to define a global var within a twig block?

Something that would work like this: {% block A %} {% set testVar = "foo" %} {% endblock %} ... {% block B %} {{ testVar }} {% endblock %} The scope of testVar seems limited to {% block A %} I'...
9
votes
2answers
794 views

Is it possible to output the name of a Matrix Block?

I'd like to output the Names of Matrix Blocks. I know you can filter by block types e.g. {% for block in entry.myMatrixField.type('text, heading') %} {% if block.type == "heading" %} <h3>{{ ...