Here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft CMS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exp:channel:entries ... } | |
{exp:playa:parents field="matrix_field_name" col="playa_col_name" var_prefix="parent"} | |
{parent:matrix_field search:matrix_col_name="[{entry_id}]" var_prefix="row"} | |
{row:some_col_name} | |
{!-- we can even loop through all of those related entries | |
(which will include the top-level entry) if we want... --} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getEntryJson(EntryModel $entry) | |
{ | |
$entryData = array(); | |
foreach ($entry->getType()->getFieldLayout()->getFields() as $field) | |
{ | |
$field = $field->getField(); | |
$handle = $field->handle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the entry | |
$entry = craft()->entries->getEntryById(100); | |
// Convert the existing data to what it would look like in POST | |
$matrixData = array(); | |
foreach ($entry->matrixField as $block) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return array( | |
'*' => array( | |
'devMode' => false, | |
'environmentVariables' => array( | |
'siteUrl' => 'http://economicexperts.eu/' | |
), | |
), | |
'.dev' => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$charset = craft()->templates->getTwig()->getCharset(); | |
$value = new \Twig_Markup($value, $charset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
entries: [ | |
{% for entry in craft.entries.find() %} | |
{ | |
title: "{{ entry.title | e('js') }}", | |
tags: [ | |
{% for tag in entry.myTagsField %} | |
"{{ tag.name | e('js') }}" {% if not loop.last %},{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Getting Started | |
* Introduction | |
* Installing & Updating | |
- Requirements | |
- Installing | |
- Updating | |
* Licensing | |
* CP Overview | |
* Packages & Plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set criteria = {section: 'cocktails', order: 'title'} %} | |
{% set prev = entry.getPrev(criteria) %} | |
{% set next = entry.getNext(criteria) %} | |
{% if prev or next %} | |
<div class="pane"> | |
{% if prev %} | |
<p>Previous: <a href="{{ prev.url }}">{{ prev.title }}</a></p> | |
{% endif %} |