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
{# | |
// lazyLoaded Image/bgImages, optimized with Imager and Focuspoint | |
--------------------------------------------------------------------------- | |
https://github.com/aelvan/Imager-Craft | |
https://github.com/smcyr/Craft-FocusPoint | |
for the bgImage intrinsic ratio classname creation check: | |
https://github.com/inuitcss/inuitcss/blob/develop/objects/_objects.ratio.scss | |
https://github.com/constancecchen/object-fit-polyfill |
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
<!DOCTYPE html> | |
<html lang="nb"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
</head> | |
<body> |
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
$('body').delegate('.load-more', 'click', function(e){ | |
//Vars | |
var | |
me = $(this), | |
target = me.attr('href'), | |
split = target.split('/'), | |
offset = split[split.length-1], | |
new_target = '', | |
container = me.attr('data-container'), |
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
gifify() { | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi | |
else |
This file has been truncated, but you can view the full file.
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
{"1359925200":[{"timestamp":1359925200,"community_id":117,"lat":38.0,"long":-97.0},{"timestamp":1359925200,"community_id":46,"lat":40.675899505615234,"long":-73.7968978881836},{"timestamp":1359925200,"community_id":378,"lat":41.777000427246094,"long":-72.52359771728516},{"timestamp":1359925200,"community_id":260,"lat":42.72840118408203,"long":-73.69180297851562},{"timestamp":1359925200,"community_id":111,"lat":39.896400451660156,"long":-75.34629821777344},{"timestamp":1359925200,"community_id":162,"lat":30.452699661254883,"long":-91.06780242919922},{"timestamp":1359925200,"community_id":25,"lat":40.04859924316406,"long":-83.07260131835938},{"timestamp":1359925200,"community_id":270,"lat":41.70389938354492,"long":-72.54609680175781},{"timestamp":1359925200,"community_id":242,"lat":42.208099365234375,"long":-70.7750015258789},{"timestamp":1359925200,"community_id":144,"lat":39.16529846191406,"long":-86.52639770507812},{"timestamp":1359925200,"community_id":373,"lat":34.81679916381836,"long":-86.68250274658203}, |
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
(function($){ | |
$(function(){ | |
var $form = $('#search'), // Search form | |
$target = $('#results'), // Results container | |
rp = 'search/ajax-results'; // Template for results only | |
// Function to execute on success | |
var success = function(data, status, xhr) { | |
$target.html(data); | |
}; |
Google updated their Analytics code from their former Urchin script (urchin.js) to their own Google Analytics (gs.js) that now allows to track:
- Site Search (e.g EE site search)
- Events (e.g file downloads) (still in closed beta Jan.11.2008)
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
<title>{title}{site_name}</title> | |
<meta name='keywords' content='{meta_keywords}' /> | |
<meta name='description' content='{meta_description}' /> | |
<link rel='canonical' href='{canonical_url}' /> | |
<meta property="og:url" content="{canonical_url}"/> | |
<meta property="og:title" content="{entry_title}"/> | |
<meta property="og:description" content="{extra:desc}"/> | |
<meta property="og:image" content="{extra:image}"/> |
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; |
NewerOlder