André Elvan
  • Member for 7 years, 7 months
  • Last seen this week
Display entry post date
Accepted answer
20 votes

{{ entry.postDate | date("M d, Y") }} Inside the date filter, you use the date formatting values documented in the PHP date() documentation. Also, see Craft's DateTime documentation, and the Twig ...

View answer
grab 'environmentVariables' with a tag
Accepted answer
19 votes

You can get to any of your config variables (including custom ones) like this: {{ craft.config.xyz }} The environmentVariables array is no different: {{ craft.config.environmentVariables.baseUrl }} ...

View answer
Can I output SVG code from an asset?
14 votes

Check out my plugin Inlin, I made it exactly for this. :)

View answer
Redactor table plugin for craft
Accepted answer
12 votes

Craft ships with Redactor’s Table plugin, but you must add it to your Redactor config yourself (in craft/config/redactor/). { // ... plugins: ['table'] } To determine which config file to ...

View answer
How to set up CloudFront for a Craft site
Accepted answer
12 votes

I'm running Amazon S3+CloudFront on several of my sites. There's not really much to it, Craft makes it really easy: Create a new Amazon S3 assets source in Craft. Set up CloudFront in AWS (see this ...

View answer
What is the difference between calling .first and .first()?
11 votes

On a more philosophical note; Put yourself in the shoes of first(). It's a method, doing an important job in the Craft eco-system. It prides itself on returning the most important and relevant data in ...

View answer
Whitespace created when using if statements
Accepted answer
10 votes

Have a look at the twig documentation regarding whitespace control: https://twig.symfony.com/doc/2.x/templates.html#whitespace-control In short, wrap the area where you want to remove whitespace in {...

View answer
Varnish 4.x and Craft
Accepted answer
10 votes

I'm by no means a Varnish pro, but I'm currently working on a project where we're running Varnish 4.0 in front of our nginx servers. I've uploaded an example of our VCL 4.0 file in this gist. It is ...

View answer
Live Preview XMLHttpRequest error
Accepted answer
10 votes

Instead of allowing cross site access, I'd recommend that you instead just make sure that the site is only accessible through one domain (not both www.domain.com and domain.com). This will also ...

View answer
Set Up A Global Dashboard For A Specific User Group
Accepted answer
8 votes

The dashboard widgets are currently set on a per user basis. Brandon has said on the Google+ community that a site-wide and/or user group solution is planned but doesn't have en ETA. https://plus....

View answer
How do I add custom styles/plugins to the rich text editor in Craft?
8 votes

Victor answers my questions regarding the formatting tags and the fact that you need to create a Craft plugin to add Redactor plugins. Since there wasn't a solution for adding classes on inline ...

View answer
Force browser to download latest CSS file
Accepted answer
7 votes

There are several plugins that can do this. With my plugin Stamp, you can add a timestamp to the filename or path in the following formats: <script src="/assets/build/js/1399647655/scripts.js"&...

View answer
How to make next/prev links for entries circular/endless
7 votes

I'm going to assume your project section is named projects, if it's not, replace it with you section name. Try this: {% if nextEntry %} {% set nextEntryUrl = nextEntry.url %} {% else %} {% ...

View answer
Accessing a Matrix field in a Global
Accepted answer
7 votes

Not sure why you're referencing "entry" in your code, I'd think the code should be: {% for block in footer.links %} {% if block.navigationLinks | length %} <h3>{{ block.navigationHeadline ...

View answer
Cannot post data to a plugin controller action
Accepted answer
7 votes

There's alot of different things that could be going on here. First, if your action is named actionPayWithPaypal (as in the code above) the action url should be paypalPayments/payment/payWithPaypal I ...

View answer
DeleteStaleTemplateCaches taking forever
Accepted answer
6 votes

This is a side-effect of Craft's amazing automagical cache system. :) Check out my answer on this question for an explanation of what happens. Regarding your question of how to fix this, part of the ...

View answer
Resolving “Stuck” Background Tasks
6 votes

If you want an even more user friendly way of doing it, install the Task Manager plugin by Bob Olde Hampsink, and you can do it from the Craft control panel.

View answer
Rich-Text/Redactor hyperlink classes
6 votes

If you only want to style how the link looks visually, and need a work-around, you could use my Redactor Styles for Craft plugin. If you add an inline style to the plugins Styles JSON object like this:...

View answer
Craft Personal for portfolio site
Accepted answer
6 votes

As long as the features are sufficient, you can use it for whatever you want. :)

View answer
Is Craft a good fit for a project w/ social network features?
6 votes

It really depends on whether you consider Craft a platform, that you're willing to do some custom development on, or an off-the-shelf, finished product. Even though I love Craft, I have to be honest. ...

View answer
Output URL to section
Accepted answer
6 votes

The url's are always bound to entries. And with your current code, you're getting all entries in the 'contact' section, not the section itself. But if this is a single, what you want is the url of ...

View answer
How do I display tags comma separated with "and" between the last two tags?
6 votes

Not very elegant, but... :) {% for tag in tags %} {{ tag.type }}{{ loop.index < loop.length-1 ? ', ' : loop.index < loop.length ? ' and' }} {% endfor %}

View answer
Include CSS file inline rather than as a link
5 votes

An alternative to the source function is using my Inlin plugin. It lets you inline files from wherever you want; the document root is the base folder, but .. works just fine.

View answer
Exclude "featured" entries from a "recent" entries {% for %} loop
Accepted answer
5 votes

What you could do is get the ids of the featured element, and exclude those from the second craft.entries call. Something like this: {# Get the ids of the featured items you got above #} {% set ...

View answer
Editing images in Rich Text Field
5 votes

Alot of features were removed from Redactor II which Craft 2.5 upgraded to. Good thing is, you can revert back to using Redactor I, by installing this plugin from Pixel & Tonic.

View answer
Importing images from external url and saving to entry using plugin
Accepted answer
5 votes

Here's how I did it in a recent project: $fileIds = array(); // get remote image and store in temp path $imageInfo = pathinfo($data['image_url']); $tempPath = CRAFT_STORAGE_PATH . '...

View answer
Entries as Flat Files
5 votes

Short answer; no. Craft uses a database to store and query for content and doesn't have any way to work with content in files the way that Statamic has. But, migrating the content into Craft's ...

View answer
How do I install Craft in shared hosting that doesn't allow index.php in a sub-folder
5 votes

It's not so much that you can't have the index.php file in a subfolder that might be an issue; it is that you can't put the craft folder above your webroot. If you have access to the folder that ...

View answer
Recommended way to include API keys in a multi-environment configuration?
Accepted answer
5 votes

You can insert whatever settings you need either in your config/general.php file, config/pluginhandle.php, or the plugin/config.php file. You can have different value for your setting in each of the ...

View answer
How to build a sentence based on tags
Accepted answer
5 votes

I think it'll be easier and more efficient to achieve that if you use the loop functionality instead of querying the actual tags. I think this code does what you want: {% set topics = '' %} {% for ...

View answer
1
2 3 4 5