Hot answers tagged

7

Adding a "^" to the craftcms version in the composer.json file and then running composer update, did the trick for me. for example: "craftcms/cms": "^3.1.22", I also cleared the cache folder in /storage/runtime/cache


5

The .htaccess file was missing the period in the filename when initially installed.


5

I bumped into this last week, and it is exactly as you suspect... your new database does not support InnoDB, which is a requirement of Craft. I'd suggest discussing the matter with your hosting company. In my case, the hosting company was unable to offer InnoDB support in any form, therefore disqualifying them as a viable hosting option for our new site.


4

I just return the form model object back to the template. Yii has built in validation and error handling within the models themselves. In the example email is the instance of your form's model. The template: {% if email is not defined %} {% set email = craft.postmaster.email() %} {% endif %} {% for error in email.getAllErrors() %} <p>{{ ...


4

Not currently, but I agree it's kind of annoying. I thought maybe you could pull it off with a plugin since Yii does have an onException event, but there wouldn't be a way to disable logging of 404's without some code changes on our end. I've added it to our 3.0 list to add a config setting to disable logging of 404's though.


4

Your guess is correct... as the docs say, you should never have devMode enabled in production environments specifically for reasons like this (as well as many others). If you find errors that are leaking sensitive server info with devMode disabled, then that is a bug and should be reported to support@buildwithcraft.com.


4

I too just had this problem - upon any action in the control panel flashed "An unknown error occurred". What I found in my craft web.log was: "ErrorException: ignore_user_abort() has been disabled for security reasons in" Apparently in my server setup via Runcloud there are various advanced boilerplate Disable_Functions. I removed "ignore_user_abort". ...


4

A long shot, but if it is indeed a path problem, this has seemed to help me keep my path(s) straight. I my config.php file, I'll set a parameter for environmentVariables like this: ... '.dev' => array( 'devMode' => true, 'siteUrl' => 'http://mysite.dev/', 'environmentVariables' => array( 'basePath' => $_SERVER['...


4

You'll get that message if Craft isn't installed and you hit the front-end of the site. You'll want to load the control panel for the installer to trigger as noted in Step 5 of the install docs.


4

There is a Quick Post widget that allows you to create entries from the Dashboard page of the Control Panel. A New Entry button is available from the entries index pages located at the top right, e.g. http:// example.com/admin/entries/news


4

This is not actually my answer since it's from Andrew Welch on Twitter here: https://mobile.twitter.com/nystudio107/status/1063135843441954816 If you have access to MySQL, you can change the admin user password to secret using this hash: $2y$13$FfVKvo1W1N5Gsba3c19r8uz.x9R5NRQgRu8jmXvOjVCStg1sKGcoW


4

If you look in the list of file paths in the stack trace there will be one or more files in the storage/runtime/compiled_templates directory. In this particular case there is storage/runtime/compiled_templates/1a/1a584296a...ccfb9.php under number 33 in the stack trace. (If you're using PhpStorm you can press shift twice and paste in the filename to find it ...


4

This was an unintentional breaking change. See https://github.com/craftcms/cms/issues/4693 Update: Fixed in 3.2.9, which is now (2019-08-06) available https://github.com/craftcms/cms/blob/develop/CHANGELOG-v3.md#329---2019-08-06


3

For whatever reason, your site isn't able to find the image. And since your Twig code isn't being defensive, it's failing ungracefully. {% set image = block.media.first() %} This first part is fine... I'm assuming that media is an Assets relationship field. You're attempting to fetch the first asset, and set that to image. Here's the kicker... when no ...


3

Numbers have certain limits in computer systems and storing (as well as working with) exceptionally large ones is cumbersome. In the database, the int (integer, a whole number) is limited to a range from -2147483648 to 2147483647. A bigint can range from -9223372036854775808 to 9223372036854775807 but is less common. And I don't think Craft uses bigints ...


3

I finally found what the problem was. The translations files (/craft/translations/de.php) were encoded as "UTF-8 with BOM" I opened these files in Sublime text and saved them as regular old UTF-8, which fixed the issue.


3

element.type is not a simple string (add {{dump(element.type)}} to your loop to see this). What you should use is element.type.handle. So the assignment is: {% set prevElementType = element.type.handle %} And the comparison (now of two strings, so no recursion) is: element.type.handle == prevElementType


3

This issue has been resolved in Sprout Email v1.0.4


3

This article will help you set permissions properly for Craft CMS installs: Hardening Craft CMS Permissions It leverages Craft-Scripts to do the heavy lifting.


3

As it turns out, I had made a configuration change that broke Craft's default behavior: 'defaultTemplateExtensions' => array('twig', 'xml') All of Craft's internal templates use .html, and HTML templates are included in the default value of that config item. By overriding it, I had rendered Craft unable to find its stock error template. Moral of the ...


3

Something should be in the logs. If it's happening on every page in the control panel, then most likely it's cURL related. Clear your craft/storage/runtime/logs files, reproduce the issue, then search the log file for [error] and that should have the underlying error message in it. If nothing is there, then the 500 error is being generated by your web ...


3

Generally speaking, only Variable classes are exposed to templates in Craft and there isn't a Variable wrapper for DateTimeHelper. However, that would be a super-simple plugin to write that exposes timeAgoInWords as a Twig filter so you could do something like entry.postDate|timeAgoInWords


3

Honestly, that's pretty much impossible to say, it could be pretty much anything – though a white screen is often due to PHP errors, in which case you might find a clue in your log files (located at /craft/storage/runtime/logs (search for [error]). Your web server's error logs might hold some clues as well.


3

Whenever I've had a completely white screen from Craft I've traced it to a syntax error in one of the files in craft/config, so I'd double-check your db.php and general.php if they've been edited.


3

Use .total() instead of .count() .count() will query the db and fetch all fields for all items relating to your criteria and then count them. .total() only counts the number of items your criteria returns without all of their fields.


3

Not sure the underlying cause, but clearing the craft/storage/runtime/cache folder that both sites shared caused both sites to start working as expected.


3

You're getting that error message because there is an existing craft/config/license.key file in place for your local installation and there is no record of that install on the Craft/web service end. Likely you've just copied an existing license.key file from another site into this new installation. So the web service on the Craft end thinks that since it's ...


3

the general.php file was setup for a multi environment but was missing '*' => array( ), as per the notice here: https://craftcms.com/docs/multi-environment-configs {basePath}assets/images/ was the correct file system path once the array had been added.


3

I'd simplify the entry like so {% set entry = craft.entries.id(5) %} {{ entry.title }}


3

This has been fixed in Craft 2.6.2804.


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