All Questions

Filter by
Sorted by
Tagged with
105 votes
8 answers
15k views

What's the best practice for handling data migration and organization across development environments?

This issue becomes especially difficult when there are multiple environments, with multiple developers working on different features that affect the data structure. The holy grail is a git-style ...
Eric Ressler's user avatar
  • 1,149
71 votes
12 answers
148k views

Getting this SQL Error: GROUP BY incompatible with sql_mode=only_full_group_by

I am getting the following error: Internal Server Error CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #18 of SELECT list is ...
user3818623's user avatar
61 votes
1 answer
12k views

How secure is Craft and why is it secure?

What measures have been put in place in regards to securing Craft at the core level. What measures have been put in place in regards to Craft's Plugins which make use of (connect to if you will) Craft'...
Natetronn's user avatar
  • 1,375
42 votes
2 answers
5k views

What are the best practices for using the {% cache %} tag?

I started using the {% cache %} tag and would like to know what the best practices are: . Regarding performance: For example does it make sense.. ..to cache the whole template, or is it better to ...
Victor's user avatar
  • 8,396
39 votes
3 answers
11k views

How to link to previous/next entries in a section?

What would be the equivalent in Craft of ExpressionEngine's Next/Previous entry linking? I was looking at getNext() and getPrev() (and their aliases next and prev) (via the EntryModel docs), but when ...
Derek Hogue's user avatar
38 votes
4 answers
22k views

Reset password with MySQL

Is there a way to reset an admin account's password by modifying the MySQL directly? I've found the craft_users table where the hashed password is stored but I don't know how to hash a string so that ...
bravokiloecho's user avatar
38 votes
5 answers
12k views

How can I retrieve channel data in json format?

I've played around with a few implementations but I still don't feel like either is right. I first came across building the JSON itself. This would be in a file at "craft/templates/entries.json". [ ...
Bill Criswell's user avatar
37 votes
4 answers
7k views

What is the current landscape regarding e-commerce plugins for Craft?

I'm developing an online store. The store needs to be seamlessly integrated with all of the editorial content on both the front and back-end. Craft is obviously a perfect candidate for the editorial ...
35 votes
11 answers
51k views

How can I add a dynamic "active" CSS class to the navigation on any given page?

Just wondering how people approach setting a class of current in their navigation. Is there anything in Craft or Twig where you can set a conditional to check if a page is the current page. Or do you ...
Gareth's user avatar
  • 1,605
34 votes
3 answers
3k views

What's the best practice for upgrading a versioned Craft site?

It's thrilling to click The Button and watch Craft update itself. I take advantage of multi-site configurations with every deploy, and my practice thus far is to... Upgrade Craft in production. ...
Matt Stein's user avatar
  • 4,006
34 votes
1 answer
12k views

What’s the recommended way to set the site URL?

There are multiple ways to set the site URL. What is the recommended way?
Brandon Kelly's user avatar
32 votes
1 answer
2k views

Is there a way I can programmatically download the latest version of Craft?

If you have a base install script that you use to quickly turn out a new base install for Craft, it would be very useful for that script to be able to download the latest version of Craft when doing ...
Brad Bell's user avatar
  • 67.5k
31 votes
4 answers
21k views

Test for empty field?

How do I check if a field is blank? I thought it was something like {% if article.articleImage is defined %} Which in this case is testing an Assets field (and seems to work). Tried the same for a ...
pumkincreative's user avatar
31 votes
2 answers
2k views

How can I prevent my client from auto-updating Craft in production?

How can I prevent my client from auto-updating Craft in production? I don't want them to run Craft updates on the production site, but the "updates" badge seems irresistible to them. I would prefer to ...
Alex Kendrick's user avatar
29 votes
2 answers
4k views

How safe is auto-updating?

I have auto-updating currently disabled using the "allowAutoUpdates" config setting, due to concerns about plugin compatibility and unforeseen breakages, mainly due to experiences with other CMS's. ...
Alex H's user avatar
  • 955
29 votes
3 answers
2k views

How do I configure Varnish to work with Craft?

Has anyone successfully used Varnish with a Craft build? I'm trying to set up Varnish on my server but I'm very new at this. Can anyone share their config file or point me in the right direction? We ...
Carlo Laitano's user avatar
27 votes
2 answers
4k views

What are the most common template performance gotchas to avoid?

I'm coming to Craft as someone experienced with Expression Engine templates. When I'm coding for EE I try to avoid certain big ticket performance hits, for example: Using embeds excessively. Using ...
mjr's user avatar
  • 1,405
25 votes
4 answers
17k views

Access environment information in template

Is there a way to check what environment craft is running on - ie, dev or not dev - via the template. For example: {%if env is 'dev'%} hello dev {% else %} hello world {% endif %}
bravokiloecho's user avatar
25 votes
9 answers
9k views

How can I build a language switcher?

I'm currently building a site with two languages, and I need a language switcher so wherever you enter the website you can switch the language easily. I've come this far: {% for locale in craft.i18n....
KSPR's user avatar
  • 3,786
25 votes
4 answers
9k views

Add home page to a structure?

I am using a structure for all of my site's pages (single pages and channel index pages). The structure settings are as follows: URL for Top-Level Entries: {slug} URL for Nested Entries: {parent.uri}...
carlcs's user avatar
  • 36.3k
25 votes
1 answer
5k views

Generating pending image transforms stuck in process

In the CMS the progress indicator for tasks is stuck and not completing its jobs. What can I do to resolve this?
a-am's user avatar
  • 2,857
24 votes
3 answers
11k views

Differences between Craft and WordPress

This is a super high level question but it would be good to get a couple of summary answers. What are the main pros and cons of Craft versus WordPress?
Andrew Fogg's user avatar
24 votes
3 answers
7k views

How can I automatically generate responsive images from a single hi-res asset?

I want to be able to upload a single high resolution image, and output a <picture> element that outputs it with a few different sizes and resolutions automatically (using Picturefill to sort out ...
Brandon Kelly's user avatar
23 votes
3 answers
4k views

How can I route a specific entry in a structure section to its own template?

While setting up a site recently I wanted to route a specific entry in a structure section to its own custom template. Using a dynamic route sounded like the right option until I remembered that it ...
Ben Croker's user avatar
  • 7,536
23 votes
1 answer
2k views

How can my plugin generate a generic modal window in the Control Panel?

I'm working on a plugin, and it requires a modal to be displayed when the user interacts with a field of my Field Type. When the user finishes interacting with the modal, they would click "Done". ...
Lindsey D's user avatar
  • 24k
22 votes
4 answers
8k views

How do I import data into Craft?

What's the best known way to import masses of data into Craft? Are there tools that support the migration of content/users from say XML, JSON etc.
Steven Grant's user avatar
  • 1,855
22 votes
1 answer
8k views

Exclude Current Entry

How can I exclude the current entry when I've structured my syntax like this? {% set entries = craft.entries({ section: 'blog', order: 'postDate', limit: 5, }) %}
Niall Thompson's user avatar
22 votes
3 answers
4k views

How can I get only those entries with non-empty assets field

Since Craft 2.0 it is possible to pass :empty: and :notempty: to ElementCriteriaModel parameters when you’re looking for empty/non-empty values. If you are for example looking for all entries with a ...
carlcs's user avatar
  • 36.3k
22 votes
1 answer
2k views

How does template caching work?

The {% cache %} tag is quite powerful, and can be used to greatly increase the performance of templates. But ultimately the whole thing is still pretty mysterious. I can see three tables in the ...
Lindsey D's user avatar
  • 24k
21 votes
3 answers
430k views

413 “Request Entity Too Large” error with uploading a file

In assets when uploading a medium size file I get this error: Failed to load resource: the server responded with a status of 413 (Request Entity Too Large) What does it mean? And how to fix?
Johannes Lamers's user avatar
21 votes
3 answers
6k views

Is there a way to output only the first paragraph of a Rich Text field?

I have a rich text output section I want to limit to the first paragraph so I can link to a full version on another page. What's the best way to do this?
Allen Pieper's user avatar
20 votes
3 answers
17k views

How can I check on the value of a template variable?

If I'm used to PHP's var_dump() and print_r() to check the value of a variable, how can I evolve to inspect things in Craft where Twig's dump isn't available?
Matt Stein's user avatar
  • 4,006
19 votes
2 answers
7k views

Section entries - order by random

I was wondering if it's was possible to order section entries by random. Example: {% for entry in craft.entries.section('team').type('mainPeople').order('title random)) %}
Willans's user avatar
  • 193
19 votes
5 answers
19k views

Create line breaks from text field

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 ...
bravokiloecho's user avatar
19 votes
3 answers
31k views

How to return a specific entry?

Hopefully this is a simple question but I couldn't find a clear answer anywhere - I just want to be able to pull in data from a specific entry, where I know the identifier. In this particular case, ...
pumkincreative's user avatar
19 votes
2 answers
6k views

Can a plugin add JS or CSS to the control panel?

Say for example, I wanted to add a "Expand/Collapse All" button to Matrix fields. Is there any way to do this, or is this something more appropriate for a feature request for P&T?
Tim Kelty's user avatar
  • 3,081
19 votes
1 answer
3k views

Where can I download previous versions of Craft?

Auto-updating is great and all, but sometimes you need to roll-back to a previous version or build of Craft for whatever reason. Where can you download these?
Brad Bell's user avatar
  • 67.5k
19 votes
4 answers
5k views

Can I run one Craft install on multiple domains and/or subdomains?

Is it possible to have one Craft install running multiple domains and/or subdomains? For example having the same Craft install running a blog Channel at blog.example.com and also an about Single at ...
Simon Kuran's user avatar
  • 3,015
19 votes
1 answer
2k views

How do I check if a lightswitch field is false?

I have a Resources page and an archived Resources page made up of entries. I want to show all current resources on the main page (this list should not include the archived ones) and on the archived ...
Carlos's user avatar
  • 193
19 votes
1 answer
8k views

How do I output the locale’s name?

When I output {{ craft.locale }} in my template, I get the current locale’s ID (e.g. “en”) rather than its name (e.g. “English”). How do I get the locale’s name?
Brandon Kelly's user avatar
19 votes
2 answers
4k views

How do I force Craft to regenerate assets transform?

I had to add an image size in the assets transforms; all my pics were previously uploaded, but when I use getUrl('headIpad'), it makes urls like this: http://host.com/cpresources/transforms/4/ ...
Kateriine's user avatar
  • 191
19 votes
1 answer
444 views

Transform Info from Handle?

Can I extract a transform's settings from its handle? I'm trying to avoid upscaling images using the workaround, and I'd like to set my transform handle dynamically within some conditionals. (see this ...
James Muspratt's user avatar
18 votes
6 answers
6k views

Solution for Matrix-within-Matrix (or More Robust Table Fields)

I was wondering if anyone has stumbled on a good solution for including matrix-like fields within a matrix block. I’m working on a site where each page's is constructed in one big matrix with several ...
philzelnar's user avatar
18 votes
9 answers
7k views

Craft constantly logging out from admin area

While working in the Craft admin area, on a fresh install, I get logged out every once in a while. It makes the CMS unusable. I have tried: Clearing cookies Resetting the cache in the backend ...
Jason D's user avatar
  • 1,132
18 votes
3 answers
5k views

Allow user to change or delete their photo for their profile from the front end

How can I allow a user to change or delete their photo for their profile from the front end? I currently have a form setup for the user to edit their profile but I want to load their current photo (...
Niall Thompson's user avatar
18 votes
1 answer
14k views

How can I determine if a user is logged in, and who that user is?

I'm running some checks to see if there is a user logged in, and if that user is someone specific. When accessing user.isCurrent it's returning 1 when I'm logged in, but returns null when I'm not. ...
Bill Columbia's user avatar
18 votes
4 answers
14k views

What is the recommended Nginx configuration for Craft?

I'm looking for the recommended way of how to configure Nginx server to run Craft. Currently, I use the following configuration, it works, but I don't know if it could be better: server { listen ...
mohd4482's user avatar
  • 612
18 votes
1 answer
7k views

How do you create a front-end form for users to submit content?

I'd like to create a form for users to load events (that I will moderate and publish). How do I do this?
Richard Frank's user avatar
18 votes
4 answers
3k views

Cache invalidation to automatically update all cached template content?

I am using the cache tag in my templates. How can I assure that a site visitor always gets the data directly from the cache and never has to wait for it to be generated? My cache gets invalidated ...
carlcs's user avatar
  • 36.3k
17 votes
4 answers
66k views

How do I target the first item in a Twig for loop?

I'm looping through some images and want to target just the first image. How do I do that? {% for image in entry.images %} <img src="{{ image.url }}" alt="{{ image.title }}"> {% endfor %}
julzmon's user avatar
  • 941

15 30 50 per page
1
2 3 4 5
289