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 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} | |
{if member_group==1} | |
<a href="{cp_url}?S=0&D=cp&C=content_publish&M=entry_form&channel_id={channel_id}&entry_id={entry_id}">EDIT</a> | |
{/if} | |
{/exp:channel:entries} |
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 | |
$passwords = array( | |
'somepassword', | |
'anotherpassword', | |
'onemorepassword' | |
// so on and so forth (don't forget the trailing commas) | |
); | |
// convert passwords to SHA1 hashes |
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
$this->EE->load->driver('channel_data'); | |
$entries = $this->EE->channel_data->get_channel_entries($channel_id); | |
foreach($entries->row() as $row) | |
{ | |
$member = $this->EE->channel_data->get_member_entries($row->author_id); | |
$data_map = array( | |
'landscapes_1' => 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
<?php | |
// Look for this in mod.channel.php (around line 2635): | |
case 'custom_field' : | |
if (strpos($corder[$key], '|') !== FALSE) | |
{ | |
$end .= "CONCAT(wd.field_id_".implode(", wd.field_id_", explode('|', $corder[$key])).")"; | |
} | |
else | |
{ |
Ever run into this error before?
Uncaught TypeError: Object [object Object] has no method 'markItUp'
If you've ever used Safecracker for ExpressionEngine chances are you have!
What's happening is Safecracker is including JavaScript for custom fields in your form for you. These custom fields rely on said js to function properly. This in itself isn't a big deal but, the issue arises because Safecracker spits out this js right smack in the middle of your template wherever your Safecracker form happens to be located.
Again not the biggest issue except:
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
$slash_type = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? '\\' : '/'; | |
$env_config['upload_preferences'] = array( | |
1 => array( | |
'name' => 'Thumbnails', | |
'server_path' => $images_path . $slash_type. 'uploads' . $slash_type . 'thumbnails/', | |
'url' => $images_url . '/uploads/thumbnails/' | |
), | |
); |
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 | |
/** | |
* An Inputfield for handling XHTML "textarea" form inputs | |
* | |
*/ | |
class InputfieldTextarea extends Inputfield { | |
const defaultRows = 5; |
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
var $dateTime = new DateTime(); | |
$dateTime->setTimezone(new DateTimeZone('America/New_york')); | |
$dateTime->setTimestamp(time()); | |
$isDst = (bool)$dateTime->format('I') ? "y" : "n"; | |
$conf['daylight_savings'] = $isDst; |
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
{gallery_matrix_images} | |
<figure> | |
<img src="{mx_file_src}" alt="{mx_text_alt_tag}" /> | |
<figcaption>{mx_textarea_caption}</figcaption> | |
</figure> | |
{/gallery_matrix_images} |