Skip to content

Instantly share code, notes, and snippets.

View iainurquhart's full-sized avatar

Iain Urquhart iainurquhart

View GitHub Profile
@iainurquhart
iainurquhart / gist:1253103
Created September 30, 2011 08:30
set_node
{exp:channel:entries channel="static" limit="1" sort="asc"{if segment_2} require_entry="yes"{/if}}
{if no_results}{redirect="404"}{/if}
<html>
<head>
{exp:taxonomy:set_node tree_id="1" key="entry_id" val="{entry_id}" var_prefix="this_"}
{styles}
<title>{title} {if segment_2}// {exp:taxonomy:breadcrumbs titles_only="yes" reverse="yes" include_here="no" delimiter=" :: "}{/if}
</title>
@iainurquhart
iainurquhart / gist:1260686
Created October 4, 2011 01:08
example screensteps template
[-- START CONFIGURATION --]
web safe= true
web safe delimiter=_
text style= html
text encoding= utf8
font family = helvetica
newline = unix
media folder= images/@LESSON_NAME
image format=png
@iainurquhart
iainurquhart / gist:1392770
Created November 25, 2011 03:44
typical page template
{exp:channel:entries
channel="pages_about"
limit="1"
status="open"
disable="{global:param_disable_default}"
require_entry="yes"} {if no_results}{redirect="404"}{/if}
{gv_html_open}
<title>{if title_override}{title_override}{if:else}{title}{/if}</title>
<meta name="description" content="{if meta_description}{meta_description}{if:else} {gv_global_meta_description}{/if}" />
<meta name="keywords" content="{if meta_keywords}{keywords}{if:else}{gv_global_meta_keywords}{/if}" />
@iainurquhart
iainurquhart / gist:1435861
Created December 5, 2011 23:16
matrix hack for channel entries api
<?php
// hacks to ft.matrix.php to allow import of matrix data via channel_entries api
// which doesn't call the validate() method in the fieldtype
// --------------------------------------------------------------------------------
// CHANGE 1
// update save method which is currently:
/**
@iainurquhart
iainurquhart / gist:1873631
Created February 21, 2012 04:18
Next/Prev Node tags
{exp:channel:entries limit="1"}
<!-- set the current node -->
{exp:taxonomy:set_node tree_id="1" key="entry_id" val="{entry_id}" var_prefix="this_"}
<!-- Le Nav -->
<nav>
{exp:taxonomy:nav auto_expand="yes"}
<a href="{node_url}">{node_title}</a>
{/exp:taxonomy:nav}
@iainurquhart
iainurquhart / gist:1875423
Created February 21, 2012 09:30
Stash and Taxonomy, example usage
<!--
PARENT TEMPLATE, /pages for example
-->
{exp:channel:entries limit="1" disable="member_data|pagination|categories"}
<!-- set the node -->
{exp:taxonomy:set_node tree_id="1" key="entry_id" val="{entry_id}" var_prefix="this_"}
<!-- stash the nav -->
@iainurquhart
iainurquhart / gist:1921456
Created February 27, 2012 04:42
pointee views/field.php
<div id="<?=$field_name?>_pointee_img" class="pointee_wrapper">
<div class="inset">
<? if($fixed_img_url != ''):?>
<img src="<?=$fixed_img_url?>" class="pointee_image" />
<div class="pointee_map_marker pointee_<?=$color?>"></div>
<? elseif($display_image !=''): ?>
<img src="<?=$display_image?>" class="pointee_image" />
<div class="pointee_map_marker pointee_<?=$color?>"></div>
<? else: ?>
<p class="pointee_get_started"><?=lang('upload_select_prompt')?></p>
{exp:channel:entries limit="1" disable="member_data|pagination|categories"}
<!-- set the node -->
{exp:taxonomy:set_node tree_id="1" key="entry_id" val="{entry_id}" var_prefix="this_"}
<!-- top nav -->
<ul id="top_nav">
{exp:taxonomy:nav style="linear" depth="1"}
<li><a href="{node_url}"{if node_active || node_active_parent && node_level} class="active"{/if}>{node_title}</a></li>
{/exp:taxonomy:nav}
@iainurquhart
iainurquhart / gist:2730275
Created May 19, 2012 09:43
pi.gwcode_catmenu.php show_empty param not honoring multiple channels using the same category group
<?php
// From line 316 pi.gwcode_catmenu.php
// subquery does not take into consideration the channel requested:
if($this->custom_fields == 'no') {
$sql = 'SELECT c.site_id, c.cat_id, c.group_id, c.parent_id, c.cat_name, c.cat_url_title, c.cat_description, c.cat_image, c.cat_order, ' .
'(' .
'SELECT COUNT(ct.entry_id) ' .
'FROM exp_channel_titles ct, exp_category_posts cp ' .
'WHERE cp.entry_id=ct.entry_id AND ct.status IN (\''.$status.'\') AND cp.cat_id=c.cat_id' .
') AS entry_count ' .
@iainurquhart
iainurquhart / gist:3617489
Created September 4, 2012 06:14
Hack for solpace supersearch to allow global fields
// search for 'Add Gypsy Test' in mod.super_search and you'll see where they've catered for gypsy.
// add this method before or after that conditional
// -------------------------------------
// Add our global fields
// -------------------------------------
if( $this->EE->config->item('global_field_ids') )
{
$sql = "/* Super Search get fields */ SELECT