Skip to content

Instantly share code, notes, and snippets.

View iainurquhart's full-sized avatar

Iain Urquhart iainurquhart

View GitHub Profile
{exp:taxonomy:get_node
tree_id="1"
key="url_title"
val="{last_segment}"
}
<p>This node is {this_node_level} levels deep!</p>
{/exp:taxonomy:get_node}
{exp:taxonomy:get_node tree_id="1" entry_id="{entry_id}"}
<p>This node is {this_node_level} levels deep!</p>
{/exp:taxonomy:get_node}
{exp:taxonomy:breadcrumbs}
{if here}
{node_title}
{if:else}
<a href="{node_url}">{node_title}</a> &rarr;
{/if}
{/exp:taxonomy:breadcrumbs}
{exp:taxonomy:nav
auto_expand="yes"
tree_id="1"
style="linear"
}
{if node_level_count == 1}<ul>{/if}
<li class="node_{node_id}{if node_active} active{/if}{if node_active_parent} active_parent{/if}">
<a href="{node_url}">{node_title}</a>{children}</li>
{if node_level_count == node_level_total_count}</ul>{/if}
{/exp:taxonomy:nav}
@iainurquhart
iainurquhart / gist:5607482
Created May 19, 2013 12:12
Matrix and Channel Entries API
<?php
// example incoming data
$operator['online_profiles'][] = array(
'PROFILE_TYPE' => 'facebook',
'PROFILE_DATA' => 'http://facebook.com/foo'
);
// prep for matrix API
// field_id and col_id hardcoded
@iainurquhart
iainurquhart / gist:4093798
Created November 17, 2012 06:27
blx.entries
{% for entry in blx.entries.findEntries({ section: 'Blog', limit: '100', order: "postdate"}) %}
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
{% endfor %}
@iainurquhart
iainurquhart / gist:3792249
Created September 27, 2012 05:02
#eecms API privelages
// this used to work:
function login_temporary_user()
{
if( $this->EE->session->userdata['member_id'] == 0)
{
$this->EE->session->create_new_session(1, TRUE);
$this->EE->session->userdata['group_id'] = 1;
}
}
@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
@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 ' .
{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}