Skip to content

Instantly share code, notes, and snippets.

View jasonvarga's full-sized avatar
🇦🇺

Jason Varga jasonvarga

🇦🇺
View GitHub Profile
@jasonvarga
jasonvarga / gist:3295628
Created August 8, 2012 14:55
File uploads from dynamic path
/**
* Custom upload directory paths
*
* The array keys must match the ID from exp_upload_prefs
*/
$env_config['upload_preferences'] = array(
1 => array(
'name' => 'Assets',
'server_path' => $base_path . '/assets/',
'url' => $base_url . '/assets/',
@jasonvarga
jasonvarga / gist:3363478
Created August 15, 2012 20:44
Simple ExpressionEngine 301 Redirect Channel
{exp:channel:entries
channel="redirects"
disable="categories|member_data|pagination"}
{exp:http_header status="301" location="{redirect_url}" terminate="yes"}
{/exp:channel:entries}
@jasonvarga
jasonvarga / gist:3374103
Created August 16, 2012 22:14
Retailer index page
{embed="_inc/_wrapper" body_class="retailer-locator"}
{exp:stash:set}
{stash:meta}
<title>Retailer Locator | {site_name}</title>
{/stash:meta}
{stash:content}
@jasonvarga
jasonvarga / gist:4617306
Last active December 11, 2015 14:58
Product Page Layout/view
{sn_page_start}
<h1>{exp:stash:title}</h1>
<p class="product-price">{exp:stash:price}</p>
<div class="split reversed">
<div class="split-1">
<a href="{exp:stash:get name='image'}" class="product-image" title="{exp:stash:get name='title' random}" rel="images">
{exp:ce_img:single
@jasonvarga
jasonvarga / gist:4617311
Created January 24, 2013 03:03
Product Page Model
{!-- Wrapper template --}
{stash:embed:layouts:product}
{!-- Custom field prefix --}
{preload_replace:cf="cf_product_"}
{exp:channel:entries
channel="products"
url_title="{segment_2}"
limit="1"
@jasonvarga
jasonvarga / gist:4617359
Created January 24, 2013 03:18
Product Index
{exp:ifelse parse="inward"}
{if segment_2}
{!-- If there's a segment_2, eg. /shop/my-product it means we're on a product page. --}
{embed="shop/_product"}
{if:else}
{!-- If there's no segment_2, eg. /shop/ it means we're on the listing page. --}
{embed="shop/_listing"}
{/if}
{/exp:ifelse}
@jasonvarga
jasonvarga / gist:5415733
Last active December 1, 2021 03:26
Fix for EpicEditor
<?php
class Hooks_epiceditor extends Hooks {
function control_panel__add_to_head() {
return $this->js->link('epiceditor.min.js');
}
}
@jasonvarga
jasonvarga / gist:6384974
Created August 30, 2013 00:20
Even/Odd statement in Switchee and IfElse
<h2>IfElse</h2>
{exp:channel:entries channel="blog" dynamic="no"}
{exp:ifelse parse="inward"}
{if "{switch='odd|even'}" == "odd"}
<b>{title}</b><br />
{if:else}
{title}<br />
{/if}
{/exp:ifelse}
{/exp:channel:entries}
@jasonvarga
jasonvarga / checkout.html
Last active December 28, 2015 06:59
Bison checkout form example
{{ bison:checkout_form_errors }}
{{ if missing }}
<p>You are missing the following fields.</p>
<ul>
{{ missing }}
<li>The {{ field_label }} field {{ message }}</li>
{{ /missing }}
</ul>
{{ endif }}
{{ if gateway }}
@jasonvarga
jasonvarga / gist:7492322
Last active December 28, 2015 11:19
Bison and Stripe integration
<div id="payment-errors">
{{ bison:checkout_form_errors }}
{{ if missing }}
<p>You are missing the following fields.</p>
<ul>
{{ missing }}
<li>The {{ field_label }} field {{ message }}</li>
{{ /missing }}
</ul>
{{ endif }}