Hot answers tagged

6

First up I'm not sure if I actually need to place any information into the Entry URL Format and Entry Template settings for the section Nope, you can probably just un-check the Entries in this section have their own URLs checkbox in the Section settings and don't worry about it – I'm guessing the nav items should only function as pointers to "actual" ...


4

In your code block.type is the matrix block type, ie homeSlider. There's alot going on in your code that I'm not sure is intended or not, but let's say you had the fields mainImage and imageText as required fields in there, and have an optional whiteLogo (not sure where that link's suppose to go, it's not in your original html). Try something like this: {%...


3

You can get the entry IDs that have are related to the category and then exclude them from the all the entries. {% set entryIdsWithCategory = craft.entries.section('driverPositions').relatedTo('7192').limit(null).ids() %} {% set entryIdsWithoutCategory = craft.entries.section('driverPositions').limit(null).ids()|without(entryIdsWithCategory) %} {% set ...


3

Craft is an MVC application, so most requests initially will get routed to a controller action. Steps 3-6 in our Routing docs page show the various ways that the target controller action is decided. Controller actions can really do whatever they want with the request at that point, but typically they will perform some level of authorization, and then either ...


3

Because logoSlider.image is an array of images (even if there's only one image in the array) you need an additional 'for' loop to catch all of the images (not just the first or last). Try something like this: {% for logoSlider in entry.logoSlider %} {% if logoSlider.type == 'logo' %} {% for image in logoSlider.image %} <div class="column ...


3

You can use Twig's "raw" filter to prevent the HTML from being escaped {{ cycle(['<div></div>', '2', '3', '4'], loop.index0)|raw }}


2

If you're looking to just output the value of the PositionSelect field, it's block.placement. See here for more info: http://buildwithcraft.com/docs/position-select-fields#templating


2

Great question! While seemingly tricky, the solution to this should be relatively simple... Per the documentation, the locations parameter can come in a variety of different forms. But the one we're looking for here is this one... As an array of elements Collecting Matrix blocks from across different entries can be complicated, but I think you have (...


1

And this solved the problem: "Attr.AllowedFrameTargets": ["_blank"]


1

If you must insist on using such a long field name rather than putting it in your twig template, then this code should work: {% set field = craft.fields.getFieldByHandle('fieldName') %} {% for blockType in field.getFieldType.getSettings.blockTypes %} {% if blockType == 'pet' %} {% for field in blockType.fields %} {% if field.handle =...


1

I believe that it is not possible looking at the Matrix Block Model Docs. What I would usually do, instead of having the front end facing title as the Field Name, is keep the Field name solely for the back end. An example be (for a front end form) <label>{{ 'Is your pet ever aggressive to strangers?' | t }}</label> {% for option in matrixBlock....


1

That's because getSegments() returns an array. You can either get one of those segments by using: {% set segments = craft.request.getSegments() %} {{ segments[0] }} Or loop through all returned segments: {% for segment in craft.request.getSegments() %} {{ segment }} {% endfor %}


1

Lots of different ways to skin the snake here but depending on how big your site site is, why create a separate structure section to begin with? For a recent build, I created a "Pages" structure section and put most of the relevant content in there. For "feeds" of data, like a Gallery or News or Employees and what not, you definitely want to use separate ...


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