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
html { | |
/* Adjust font size */ | |
font-size: 100%; | |
-webkit-text-size-adjust: 100%; | |
/* Font varient */ | |
font-variant-ligatures: none; | |
-webkit-font-variant-ligatures: none; | |
/* Smoothing */ | |
text-rendering: optimizeLegibility; | |
-moz-osx-font-smoothing: grayscale; |
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
{% if craft.request.isAjax %} | |
{% set layout = "_ajaxLayout" %} | |
{% else %} | |
{% set layout = "_layout" %} | |
{% endif %} | |
{% extends layout %} | |
{% set limit = 10 %} | |
{% set params = { section: 'news', limit: limit} %} |
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 pageURL = window.location.href; | |
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1); | |
console.log(lastURLSegment); |
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> | |
<head> | |
{# Base #} | |
{% includeCssFile 'layouts/base/css/base.css' %} | |
{% includeJsFile 'layouts/base/js/base.js' %} | |
{# Header #} | |
{% includeCssFile 'modules/header/css/header.css' %} | |
{% includeJsFile 'modules/header/js/header.js' %} |
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 hqLocation = new google.maps.LatLng(-35.107231, 147.369983); | |
var mapOptions = { | |
zoom: 17, | |
minZoom: 17, | |
maxZoom: 17, | |
center: hqLocation, | |
scrollwheel: false, | |
disableDefaultUI: true, | |
keyboardShortcuts: false, |
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
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done |
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 | |
namespace Craft; | |
// This file could be placed into your public_html folder and visited to import a cheese product. | |
$craft = require '../craft/app/bootstrap.php'; | |
$craft->plugins->loadPlugins(); | |
$newProduct = new Commerce_ProductModel(); |
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
# gzip compression -- make it faster! | |
SetOutputFilter DEFLATE | |
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip | |
Header append Vary User-Agent env=!dont-vary |
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
// Declare globally to use throughout | |
var deviceOrientation = ''; | |
// ---------------------------------------------------- | |
// Detect screen orientation | |
// ---------------------------------------------------- | |
function detectOrientation() { | |
var height = $(window).height(); | |
var width = $(window).width(); | |
if(width > height) { |
NewerOlder