Skip to content

Instantly share code, notes, and snippets.

@ijy
ijy / tutorial.md
Created October 4, 2012 12:26 — forked from liuwen-lvtu/tutorial.mkdn
A new Susy tutorial

Susy Tutorial

For this tutorial I'm assuming you are already comfortable with CSS, Sass (I'll use the SCSS syntax) and Compass. Please get set up with each one of those before attempting to use Susy. Sass and Compass both have their own setup instructions and tutorials that you can use.

There is also reference documentation in the works.

What Susy Does

CSS Systems

<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcetour_l_current_presentation_images extends SectionDatasource{
public $dsParamROOTELEMENT = 'tour-l-current-presentation-images';
public $dsParamORDER = 'asc';
public $dsParamPAGINATERESULTS = 'yes';
public $dsParamLIMIT = '1';
@ijy
ijy / EE: Store: Hide modifier option if out of stock
Last active December 18, 2015 20:48
ExpressionEngine: How to conditionally hide modifier options depending on inventory count in Expresso Store 1.6+. {option_stock_level} can be used inside the {modifier_options} tag pair to output the current stock level for that modifier option. It can also be used (as in this example) to conditionally hide modifier options if out of stock.
{modifier_options}
{if option_stock_level > 0}
<option value="{option_id}">
{option_name} {if price_mod_val} ({price_mod}) {/if}
</option>
{/if}
{/modifier_options}
@ijy
ijy / EE: Dynamic parameter values
Created June 22, 2013 22:41
How to pass in dynamic values to ExpressionEngine tag parameters. (How to use plugin tags inside EE tags). The two secret ingredients are parse="inward" to parse the dynamic inner tag first. The second is the 'random' keyword to ensure the dynamic parameter value is used instead of a placeholder string.
{exp:channel:entries parse="inward" parameter="{exp:plugin:method parameter='value' random}" }
@ijy
ijy / EE: Matrix: Row count not empty
Created June 22, 2013 22:46
Return the total number of rows in a Matrix where a specified column is not empty. the_matrix refers to the name of the Matrix field. my_col refers to the column to search on.
{the_matrix:total_rows search:my_col="not IS_EMPTY"}
@ijy
ijy / EE: Matrix: If no results on search
Last active December 18, 2015 20:49
Conditionally check whether a Matrix is empty when searching on a particular column. Can be used with a Playa relationship field.
@ijy
ijy / Symphony 2.3 Custom Data Source.php
Last active December 18, 2015 20:49
Symphony 2.3 custom Data Source shell.
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcetour_l_current_presentation_images extends SectionDatasource{
public $dsParamROOTELEMENT = 'tour-l-current-presentation-images';
public $dsParamORDER = 'asc';
public $dsParamPAGINATERESULTS = 'yes';
public $dsParamLIMIT = '1';
@ijy
ijy / Laravel: Blade: Limit foreach loop.php
Created June 22, 2013 23:15
A quick and easy way to limit a foreach loop in Laravel Blade.
@foreach (array_slice($posts->toArray(), 0, 5) as $post)
<h1>{{ $post['title'] }}</h1>
@endforeach
@ijy
ijy / querystring-params.php
Created June 28, 2013 14:04
Convert query string params into an arrary
$querystring = 'a=foo&b=bar';
parse_str($querystring, $params);
// Test it
echo "<pre>";
print_r($params);
echo "</pre>";
@ijy
ijy / chromeframe.html
Created June 28, 2013 14:05
Add Chrome Frame prompt for IE6+7.
<!-- Prompt IE6 users to install Chrome Frame -->
<!--[if lt IE 8 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
<![endif]-->