Lots of people have asked, so here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft.
This file contains hidden or 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 navItems = craft.facetedNav.getNav() %} | |
<nav class="sidebar"> | |
{% for catGroup in navItems.categoryGroups %} | |
<fieldset> | |
<legend>{{ catGroup.name }}</legend> | |
<ul> | |
{% for cat in attribute(navItems.categories, catGroup.handle) %} | |
<li{% if cat.active %} class="active-item"{% endif %}> |
This file contains hidden or 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
$customDbConfig = array( | |
'*' => array( | |
'tablePrefix' => 'craft', | |
), | |
'test1.foo.com' => array( | |
'server' => 'localhost', | |
'user' => 'test1user', | |
'password' => '', |
This file contains hidden or 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
{% for profileRow in entry.teamProfiles|batch(4) %} | |
<div class="row team_members_wrapper"> | |
{% for profile in profileRow %} | |
<div class="col-sm-6 col-md-3"> | |
<div class="team_member"> | |
{% set photo = profile.photo.first() %} | |
{% if photo is not empty %} | |
<img src="{{photo.url}}" alt="{{ profile.personName }}"> | |
{% endif %} | |
<h5>{{ profile.personName }}</h5> |
This file contains hidden or 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
$criteria = craft()->elements->getCriteria(ElementType::Entry); | |
$criteria->limit = 100; | |
$criteria->sectionId = 4; | |
$entries = craft()->elements->findElements($criteria); | |
foreach($entries as $entry) | |
{ | |
... |
This file contains hidden or 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 topEntry = craft.entries.depth(1).slug('about-us').first() %} | |
{% set parents = entry.getAncestors() %} | |
<ul> | |
{% nav item in topEntry.getDescendants() %} | |
{% set isParent = false %} | |
{% for parentItems in parents %} | |
{% if parentItems.id == item.id %} |
This file contains hidden or 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 topEntry = craft.entries.depth(1).slug('about-us').first() %} | |
{% set parents = entry.getAncestors() %} | |
<ul> | |
{% nav item in topEntry.getDescendants() %} | |
{% set showChildren = false %} | |
{% for parentItems in parents %} | |
{% if parentItems.id == item.id or entry.id == item.id %} |
This file contains hidden or 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
# Description: | |
# Shows an image the specified Goonie somewhere. | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: |
This file contains hidden or 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
<table class="mainTable entry_widget_notop" border="0" cellspacing="0" cellpadding="0" data-index="0"> | |
<tbody> | |
<tr> | |
<td style="width: 100px;"> | |
<?php if($options['image_id']):?> | |
<img src="/?ACT=40&file_id=<?=$options['image_id']?>&size=100x100&hash=1361909881"> | |
<?php endif ?> | |
<p><a href="#" class="thumbnail_trigger">Add File</a></p> |
This file contains hidden or 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 channel="some_pages" limit="1"} | |
{exp:taxonomy:set_node | |
tree_id="2" | |
entry_id="{entry_id}" | |
} | |
<p>You are here: | |
{exp:taxonomy:breadcrumbs} | |
{if here} |
NewerOlder