KSPR
  • Member for 7 years, 7 months
  • Last seen this week
  • Bern, Switzerland
Is it possible to exclude multiple sections from an entry search query?
Accepted answer
29 votes

The trick is to add and once before the first not {% set entries = craft.entries.search(query).section('and, not this, not that') %}

View answer
List all entries below top level 1 in a structure section (level 2 or 3 or 4 ...)
Accepted answer
9 votes

Alright. you can just exclude the top level entries with not: {% set entries = craft.entries.section('library').level('not 1') %}

View answer
Why does my base template never reload?
8 votes

For those interested: Disabling opCache in Mamp: Go to: /Applications/MAMP/bin/php/php5.5.3/conf/php.ini. OP Cache is at the bottom of the file. Comment out the following lines with a semicolon ;: ...

View answer
Date/Time field outputting time with additional minutes
Accepted answer
6 votes

You are using the wrong variables. The 10 is there because it means October not 10 minutes. You have to use | date("g:ia”).

View answer
Specifying administrators for localized sites?
Accepted answer
6 votes

Yes. you can: Here I created a User group which has only access to the english part of the content. As you can see these are checkboxes. So you can grant access to multiple languages at once.

View answer
Bold first word in title field
Accepted answer
5 votes

You can grab the first word with the split filter according to this thread {% set array = entry.title|split(' ', 2) %} <h1 class="section__heading"> <strong>{{ attribute(array, 0) }}&...

View answer
Problem with accents in tags & URL
5 votes

There is a general config setting for it: 'limitAutoSlugsToAscii' => true, Limits automatically-generated slugs to ASCII characters. When there is an obvious ASCII version of a character (e.g....

View answer
PHP eval filter for Twig
Accepted answer
3 votes

In Craft 3 it is actually possible. {{ craft.app.view.evaluateDynamicContent('phpinfo();') }} See: Can we use PHP in our templates instead of Twig?

View answer
Create Plugin to generate PDF files from content
3 votes

Maybe this one could help you: Printmaker

View answer
Is it possible to have multiple locales that use different domains instead of subfolders?
Accepted answer
3 votes

It is discussed here in the craft docs: There is an example with different toplevel domains. English and German each get their own domain craft/ public_html/ --> example.com/ ....

View answer
Need help with filling matrix images into CSS grid
2 votes

There is no way to determine if an image should go to the first block.type == 'A' if statement or the second one you could write something like this: {% switch block.type %} {% case 'A' %} ...

View answer
Text cut off after migration in some fields
2 votes

Found the issue with the awesome Craft support. There seems to be a server related issue where db tables change from TEXT to VARCHAR. So the solution is to change those fields back to TEXT directly ...

View answer
Sections in local & LIVE out of sync
2 votes

If I create a folder assets at that location it works. I don't know what this asset folder is about.

View answer
Best practice for year based paging
2 votes

Welcome to craft 👋 There is a example for a archive on the official page: Creating an ​“Archive” Page for Entries Maybe this fit's your use case.

View answer
Error on Craft 3 install
2 votes

According to this thread you can add # Use MAMP version of PHP PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH to ....

View answer
Hiding Field on Parent Entry
2 votes

Or in Addition to Mats answer you could use the reasons plugin to hide and show fields based on a lightswitch button. But when you have lots of different fields, different entry types are the way to ...

View answer
Using the Matrix field to output content in a slideshow
2 votes

I reduced your code a little: You can use elseif to cycle trough each block so you don't have to write each if statement. Now where do you want your div? If you want each block with one separate div ...

View answer
Craft Locales and translatable image field
2 votes

One way would be to create two Asset fields. One is the default field and one is the field which is translatable into each locale. You could then steer the two fields via conditional logic: If no ...

View answer
Variable doesn't exist in one locale
2 votes

If found the issue. I didn't specify define('CRAFT_LOCALE', 'de'); in the root index.php. It doesnt suffice to create en fr folders and specify define('CRAFT_LOCALE', 'xx'); there.

View answer
url with .html extension
Accepted answer
2 votes

Okay. I found the solution If anyone runs into the same issue. This must be a server problem which I can't solve so there is a htaccess solution to remove the .html extension: RewriteEngine On ...

View answer
Craft Commerce: Frontend Validation on Address Fields
Accepted answer
1 votes

Found a solution. I just add or remove the html5 required tag on load via Javascript. This way the js who duplicates the form can do whatever it wants and the html remains untouched: // adds required ...

View answer
mkdir(): Permission denied
1 votes

Found the error. It was the asset transformations. If I change 'generateTransformsBeforePageLoad' => true, to false the site is being displayed (without images). Changing asset permissions doesn't ...

View answer
How do I set up Craft 3 to web server in WAMP?
1 votes

I only know mamp. You have to point the local domain to the web folder. If you don't change the folder structure the composer libraries will live outside the public folder just fine. Do you get any ...

View answer
Stop Redactor automatically creating hyperlinks
1 votes

Use the autoparse option to deactivate that behaviour in the redactor configs Go to: config/redactor/ and add this I believe (untested): { "whatever": true, "autoparseStart": false }

View answer
Store Contact Form submissions
1 votes

Yeah. The contact-form plugin of craft is rather rough around the edges. I especially miss a error-handling. The form plugin just fails silently. As a replacement I'd go for AM Forms Sospace's ...

View answer
403 Error on homepage of second language
Accepted answer
1 votes

Did you define the the locale url in your config? I do it like this: .env SITE_URL_DE="@web" SITE_URL_EN="@web/en" SITE_URL_FR="@web/fr" SITE_URL_IT="@web/it" general.php // Global settings '*' ...

View answer
Redactor - Superscript button
1 votes

I made another pretty easy solution: {{ entry.redactor | nl2br | replace({'/m3': '/m<sup>3</sup>'}) | raw }} It just replaces the units with the coresponding html markup. It works nice :)...

View answer
Issue Devmode is still enable in multi-environment config file
1 votes

The ordersequence of the environements does matter. return array( '*' => array( //yadayadayada ), // this has priority over the lower entry '.com' => array( 'devMode' => true,...

View answer
Pass active class into dropdown
Accepted answer
1 votes

Heck! I just did it with jQuery: $('.nav .dropdown-menu li.active').parents('li').addClass('activeParent');​ and that's that.

View answer
Invalidate cache from two channel expiry dates
Accepted answer
1 votes

the error was with the date format in the date comparison conditional and the until tag instead of unless {% if currentTime <= newsDate | date('c') %} {# those two dates were formated differentely ...

View answer