Skip to content

Instantly share code, notes, and snippets.

View objectivehtml's full-sized avatar

Justin Kimbrell objectivehtml

  • Woodland Park, CO
View GitHub Profile
@objectivehtml
objectivehtml / gist:3609600
Created September 3, 2012 14:12
Authenticate Ajax Submit Example
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function submit(form, callback) {
var action = form.attr('action');
var post = {};
form.find('input, select, textarea').each(function() {
var $t = $(this);
@objectivehtml
objectivehtml / gist:3427766
Created August 22, 2012 17:29
PHP Dynamic Setter/Getter Magic Method
<?php
public function __call($method, $args)
{
foreach(array('/^get_/' => 'get_' , '/^set_/' => 'set_') as $regex => $replace)
{
if(preg_match($regex, $method))
{
$property = str_replace($replace, '', $method);
$method = rtrim($replace, '_');
@objectivehtml
objectivehtml / gist:3407563
Created August 20, 2012 20:27
New Channel Data Example
<?php
/*
Advanced Query with Channel Data
Obviously the logic in this query is not something that anyone
with any sense would actually use. Rather, this example simply
shows the order of operations and everything that is possible
with the new version of Channel Data (v.8.0).
<?php
public function settings()
{
$this->EE->cp->set_right_nav(array(
'&larr; Back to Schemas' => $this->cp_url('schemas'),
));
$fields = array(
'settings' => array(
{exp:stash:set_value name="page_title" value="News"}
{exp:stash:set name="page_content"}
<section class="section grey-texture">
<div class="row">
<div class="nine columns">
{exp:stash:set name="page_content" process="end"}
<h1>Order History</h1>
<ul class="orders">
{exp:channel:entries
channel="orders"
dynamic="no"
author_id="CURRENT_USER"
}
public function import_item_action()
{
$item = $this->EE->data_import_model->get_item($this->EE->input->get_post('schema_id'));
$settings = $this->EE->data_import_model->get_setting($this->EE->input->get_post('schema_id'));
$data = (array) json_decode($item->data);
foreach(explode('|', $item->categories) as $category)
{
// Results in this warning, "Creating default object from empty value"
$some_var = 'some_property';
$options = (object) array();
$options->$some_var = TRUE;
@objectivehtml
objectivehtml / gist:3018811
Created June 29, 2012 16:01
Example of Playa not working
{exp:gmap:init id="map" scrollwheel="false" style="width:100%;height:500px"}
{exp:channel:entries channel="bars" disable="member_data|pagination|categories|category_fields"}
{bars_location id="map"}
<h3>{title}</h3>
<p>Beers here:</p>
@objectivehtml
objectivehtml / gist:3005284
Created June 27, 2012 16:38
Newsletter Subscription Delegate Example
{exp:postmaster:delegate:newsletter:subscribe_form
service="mailchimp"
api_key="YOUR_API_KEY"
list="YOUR_LIST_ID"
class="newsletter"
novalidate="novalidate"
return="/thanks-for-subscribing"
}
<div class="row">