Most Popular
1500 questions
4
votes
2 answers
Craft 3 Custom Plugin: model validation
Struggling a bit here - have created a custom plugin where I want to validate form submission against a predefined model before saving to the database. All pretty straightforward so far …
However, if I try to use native (Yii 2) validation then a…
Cole Henley
- 1,741
- 11
- 20
4
votes
1 answer
Get related posts excluding current post in Craft 3
In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post. I got this far:
{% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %}
That gets five posts sharing the current post’s…
Eric A. Meyer
- 155
- 6
4
votes
2 answers
How do I get the primary site URL?
Is there an available variable for the primary site URL in a multi-site CraftCMS setup? I need a variable that I can attach to my logo that will take the user back to the primary site. I could hard code this, however, the URL needs to be environment…
Vaughn D. Taylor
- 609
- 1
- 4
- 14
4
votes
1 answer
Getting entries related to all of supplied categories, if they exist
I'm trying to get all entries that related to one .. three categories, as determined whether their id appears in the query string:
{% set sector = craft.categories.id(craft.request.getQuery('sector')) %}
{% set impact =…
Daniel
- 343
- 3
- 8
4
votes
1 answer
Getting full native language name in Craft 3 language switcher
I'm porting across a multilingual project from Craft2 to Craft3 and have to rebuild the language switcher. I was previously using the .nativeName method but apparently this is deprecated. I've got a really basic one working for flipping between the…
Dr_Codswallop
- 169
- 9
4
votes
1 answer
Asset dynamic subfolder for User Matrix
I need to set an asset field's dynamic subfolder path to the User ID.
The field is within a matrix.
The matrix a field in a User profile.
Setting it to {currentUser.id}, {owner.author.id}, {object.author.id} results in an invalid path message when…
Adam Menczykowski
- 1,390
- 11
- 22
4
votes
3 answers
Craft 3 cannot find mysqldump command, console works
I want to use Feed Me with Craft to import my old database, but neither Feed Me nor Craft can find mysqldump.
I know this is a known problem, and I have successfully added the path to $PATH and verified that this is set in my .bash_profile.
When I…
Crafty Cat
- 335
- 1
- 10
4
votes
3 answers
How can I use within a redactor/rich-text field?
We need to be able to add super and sub-text to a rich text field without having the client dive into the markup. Has anyone successfully added this as a redactor or Craft plugin?
Bill Columbia
- 896
- 1
- 8
- 18
4
votes
1 answer
Is there any Booking/Reservation system for Craft 3?
I couldn't find any booking/reservation system for Craft. Is there any? I found questions from 2014, so things could change.
Maybe there is community-approved booking/reservation service that is commonly used with Craft, but it doesn't have the…
curious
- 383
- 3
- 13
4
votes
1 answer
Caching in Craft 3 causes out of memory when including grouped for loop
I have a problem with using {% cache %}in Craft 3, although the code runs fine without caching, and it works in Craft 2.
I have narrowed the problem down to the following code:
{% cache %}
{% set upcomingShows =…
KSP
- 849
- 6
- 16
4
votes
1 answer
Does composer update make changes to the SQL database
When creating plugins on my local I need to run composer update to make sure everything is in sync. In order to make sure the client has the same vendor and plugin folders, I then upload them to the server.
I just want make sure that when running…
Dan Zuzevich
- 487
- 2
- 18
4
votes
1 answer
Passing Entry to craft()->templates->render()
In looking over the docs on template rendering I am not seeing a way to pass in an Entry model. It seems more efficient to pass in an existing model rather than have the template do another lookup. Something like:
$html =…
David A McInnis
- 1,201
- 12
- 26
4
votes
2 answers
Craft CMS 3.0 - Log file?
I've been playing around with Craft 3.0 and am just about to develop a site using it. First thing I see when testing my frontpage template is "Internal server error", styled as a Craft error box.
So my question is simple, where is the log file for…
Kenny Bones
- 273
- 3
- 11
4
votes
1 answer
Fetching localized globals?
I have a site that is mixed English and Chinese. I've properly set up the locale to include Chinese as a locale, and have put Chinese translations for my fields in place. That all works.
However, the site isn't one where you'll pick Chinese or…
andrew.welch
- 11,551
- 22
- 31
4
votes
1 answer
Where should I put custom CSS files?
I am a little puzzled by the way craft handles CSS files. Although I am used to working with SCSS and CSS assets and setting up a reasonable directory structure, I was expecting a little documentation or a best practice recommendation.
At first, I…
Christoph Kepper
- 107
- 1
- 5