Skip to content

Instantly share code, notes, and snippets.

View iainurquhart's full-sized avatar

Iain Urquhart iainurquhart

View GitHub Profile
@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: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: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
{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}
{exp:taxonomy:breadcrumbs}
{if here}
{node_title}
{if:else}
<a href="{node_url}">{node_title}</a> &rarr;
{/if}
{/exp:taxonomy:breadcrumbs}
{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: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:nav tree_id="1"}
<li> <a href="{node_url}">{node_title}</a> {children} </li>
{/exp:taxonomy:nav}
{exp:channel:entries channel="some_pages" limit="1"}
{exp:taxonomy:set_node
tree_id="2"
entry_id="{entry_id}"
add_globals="yes"
}
<p>You are here:
{exp:taxonomy:breadcrumbs}
{exp:taxonomy:entries parent_entry_id="{entry_id}" dynamic="no"}
<h2><a href="{exp:taxonomy:node_url entry_id="{tx:entry_id}"}">{tx:title}</a></h2>
<p>{tx:page_introduction}</p>
{/exp:taxonomy:entries}