I'm looking for a way to output line break from a text field.
I'm aware of the "Allow line breaks" option and I have set that to true. I've then entered text with multiple new lines. However, when this text gets output in the template, there are no…
Does anyone know of a way to instruct PHPStorm to treat Craft templates as Twig files, without globally assigning all .html files to be interpreted as Twig? Since Craft templates don't use the .twig extension, PHPStorm thinks they're HTML.
On that…
I've created a plain text-field and added this field into a section.
I then created an entry and filled it with content.
I know I can output the content of the field in my template with {{ entry.field_handle }}, but is it also possible to display…
Does anyone know how to make Craft by default use .twig extensions. It helps IDEs better understand Twig blocks. I have tried .twig and .html.twig but it doesn't appear to work by default.
I don't want to set up special configs for every template.
I have a site with 10000 events which need to expire once they have happened, the main reason for this is to keep things tidy in the CP.
We need users to view events that they have completed after they have expired.
Is there an easy way to render…
Curious if I'm able to use the resizer on a random, sourced image, not coming from a field anywhere.
So I would just be passing a string to the path of the image.
I'm trying to run a check within my _layout.html' to remove the navigation bar if the user is on the homepage. I've tried with the following code below, but browsing to a page which is theindex.html` of a Channel breaks the code with the following…
Is it not possible to define multiple conditions in an if statement?
{% if foo == 'x' || foo == 'y' %}
I tried this and got an error:
Unexpected token "punctuation" of value "|" ("name" expected)
I am trying to code defensively and check whether a field exists before accessing it:
{% if e.someField is defined %} {{e.someField}} {% endif %}
And I get a CException
Craft\EntryModel and its behaviors do not have a method or closure named…
For example, if I'd like to serve a file as application/json or application/rss+xml
I see in the RSS Feed documentation that it mentions saving a file with .rss will auto-detect and serve the correct mime-type.
However, how is this detected? Is…
I use a pre-processor to generate my CSS. I would like to include the resulting file inline, rather than as a link. Is there a way of doing this via the twig tags in Craft?
I know I could move the CSS file to the templates folder, so that I could…
I have the following code which works fine. I'm just wondering if there is a more simple way of incrementing the id number?
{% set counter = '1' %}
{% for block in entry.news %}
{% if block.type == "bodyBlock" %}
{{ block.body }}
{% elseif…