8

While we’re piggybacking, here’s a snippet that goes one step further and generates the necessary CSS to position an untransformed image: {% set img = entry.headingImage.one %} {% if img %} {% set imgStyles = "background-image: url('" ~ img.getUrl() ~ "');"|raw %} {% if img.hasFocalPoint %} {% set x = img.focalPoint | first * 100 ~ '%' %} ...


7

Let me try to turn this into a more valuable StackExchange for others who will find it, since the original poster apparently got help and solved his problem without participating here. We can see so on the linked site, which is now running as expected for Craft, quite rapidly. What I'd like to do is suggest a less awkward way to approach his task. We can do ...


6

Douglas's answer is correct... Also, if you'd simply like to try Craft Pro before purchasing it, you can do so while running Craft in your local environment. https://craftcms.com/support/try-craft-client-pro UPDATE: It's now possible to try Craft Pro from any non-public domain: https://pixelandtonic.com/blog/test-craft-client-pro-from-any-non-public-...


6

The top links in the CP header are often called nav tabs. Beyond the "default" nav tab for your plugin (pointing to the plugin's CP section), it's possible to declare additional tabs via the modifyCpNav hook (added in Craft 2.3.2640): public function modifyCpNav(&$nav) { $nav['mypluginhandle-newsletter'] = array('label' => 'Newsletter', 'url' =&...


6

I'm not sure there is anything specifically for importing from Joomla, but you could try the Import plugin. Depending on the data format, you may also be able to use the Feed Me plugin. Edit: Alternatively, a popular Craft CMS plugin maker (Barrel Strength Design) offers a commercial service to migrate/import data from Joomla -> Craft CMS. It's called The ...


6

They have answered this on the CraftCMS site: https://craftcms.com/support/license-enforcement Edition Enforcement Each time Craft phones home to check for updates, we check the incoming license to see which edition it should be running. That “licensed edition” is included in the response, which Craft compares against what is actually installed. If there’s ...


6

Focal points are used mainly for when Asset transforms (i.e. cropping) are performed in Craft. They tell Craft where it should focus on the image when performing these actions.


5

You should just be able to do: postDate|date('m') postDate by itself should give you a DateTime object which you can then apply the filter to.


5

As another option that I usually do in addition to .htaccess, is to also add this to the array in craft/config/general.php file, and it'll stop Craft from ever adding the index.php. 'omitScriptNameInUrls' => true Doing it this way prevents Craft from ever adding in the index.php to redirects, I believe.


5

getSectionByHandle doesn't return an array, but a single SectionModel - so you need to remove the for loop: {% set enroll = craft.sections.getSectionByHandle('workshopEnrollments') %} {{ enroll.id }}


5

The answer is to create a custom plugin that will read the json files from the folders in the public directory, parse the json, and pull them into the template. An alternative solution is to use Craft custom config files. (Not the answer you're looking for but would work very well.) In craft/config create a file like localedata.php and make it something ...


5

Stack Exchange is generally for more technical questions, so you might not get many replies here. Have you contacted the folks at Pixel & Tonic directly? You could also join the Craft CMS Slack. Plenty of developers hang out on there that might not look here, so it'd be worth your while asking the same question there.


4

You'd have to write a custom plugin, that adds an event listener for the entries.saveEntry event. The event listener should go into your plugin's primary class' init method. You'll need to make sure the event listener only fires for Control Panel requests, and that the currently logged in user is assigned to the user group you want to apply this to. You ...


4

This came up in the Craft Slack not so long ago. You'd want something like this... # ------------------------------------------------------------ # Remove index.php # ------------------------------------------------------------ RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteCond %{REQUEST_URI} !^/index\.php/admin\b [NC] # Don't mess with admin ...


4

You have a lot of matrix blocks; I'm guessing that's why your output is slow. It looks like your initial query doesn't depend on any other input, so you could probably cache the whole thing. I would put cache tags before and after your whole snippet, before the first for loop near the top. Looks like you commented out your cache tags, probably because ...


4

Let's get the easy question out of the way first... Don't use Craft's localization to handle this task. While the localization feature is amazing and powerful, it doesn't fit the needs you're describing. Localization is mainly geared towards handling different languages for different countries. So what's the best way to handle this? Fortunately, it sounds ...


4

A relationship field expects an array of element IDs. So to remove a user, you'd just get all the current IDs and remove the one you want to delete. // Get the current member IDs $members = $entry->accepted->ids(); // Remove a member ID $key = array_search(52, $members); if ($key !== false) { unset($members[$key]); } // Add a new member ID $...


4

Try resetting the permissions of the storage folder: https://craftcms.com/docs/installing#step-2-set-the-permissions (It's possible that PHP was running with higher-than-default permissions in the previous setup, in which case everything may have worked even if you hadn't explicitly made the storage folder writable.)


4

There may be a better way, including adding exclusions as an array and checking if the segment exists in the array, but what about wrapping it in an if tag? This seems to work. {% if craft.request.firstSegment != 'contact' and craft.request.firstSegment != '404' %} {% include 'layouts/partials/my-template'%} {% endif %} Quick update: This is very ...


3

Do you mean have multiple tabbed content within your plugin admin area? If so yes that's possible you just need to add a tabs array in your template like so: {% set tabs = { tab1: { label: "Tab 1"|t, url: url('plugin') }, tab2: { label: "Tab 2"|t, url: url('plugin/tab2') }, } %} Then to make a tab active in the navigation you would just add this to the ...


3

You likely won't need to write a plugin at all – you can easily create different user groups (e.g. "Workers" and "Clients") from the Control Panel, and grant those groups different permissions. An example of a permission is "Access the CP". The user group permissions will be automatically applied to any new users added to the group. To create a user group, ...


3

Assuming it is already installed and running, there should be a link to upgrade in the footer of the control panel which generates a modal window with options to buy or try. Keep in mind you will need to be running your install on a domain that ends in 'craft.dev' (i.e. mysite.craft.dev). From the docs: Craft won’t automatically upgrade itself; you will ...


3

There’s no way to give a user group permission to create entries but not see those entries they created in the CP. The only way to achieve what you want would be to write a plugin that provides its own “save-entry” controller action, which allows users to create the entries without actually having the permission. The Guest Entries plugin would be a good ...


3

I think you are going to struggle with this in Craft, you would need to do it through Javascript. Craft runs off PHP which is a server side scripting language, you need a client side scripting language. Here is a good question which should help you with this: Get the size of the screen, current web page and browser window


3

It sounds like your sessions are not being sticky. How many servers? Are you having to login multiple times as well to get things done? Apart from what Brad mentioned, couple things I'd try if you haven't already: Set an appId in the config settings. You didn't mention AWS but setting an appId seems to have solved it for at least one other poster using ...


3

I think that you've outlined the process perfectly. To put the pieces together I would suggest that you create a small plugin (perhaps using the trusty BusinessLogic plugin as a starting point). To communicate with your plugin, add a 'template variable' method to your plugin's variables file, and your geolocation php. For more info see the docs on template ...


3

You would need to create a custom route in the Control Panel that matches the same basic routing as your entries. Then in the entry template, you need to add some extra code that pulls disabled entries. Something like below. {% if entry is not defined %} {% set entry = craft.entries.section('whatevs').uri(craft.request.url).status(null).first() %} {%...


3

Craft supports hierarchical, nested categories out of the box. It also supports hierarchical entries, assuming you used the Structure section type (and not a channel or single). Where Craft and Joomla differ is the output on the front end is completely up to you. There's no default "widget" or anything in Craft that is going to do exactly what you want. ...


3

Not exactly. But if you're looking for stats, devMode does some query profiling right in the console: I'm not sure if you're looking for a 1-1 correlation but you can obtain whether or not the server supports gzip with the Server variable HTTP_ACCEPT_ENCODING (kind of useless IMO). Craft also will display its version number at the bottom of the CP when you'...


3

Yes: In Craft, all Elements — including Users — can have custom fields of their own. (So, for example, each User could have a "Bio" field.) You can use a User Profile Form to allow Users to edit their own profiles. You can restrict the upload directory for each Assets field. So, for example, you could create an Assets field that stores files in a directory ...


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