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:1333617
Created November 2, 2011 13:25
New Channel Data API
Overview
--------
The idea here is to have a single "library" (in this case it's actually a driver)
that loads an API from _other_ add-ons.
For instance, say you wanted you application to interact with Google Maps for
ExpressionEngine, but you want to do it in a nice easy to use fashion without loading
a whole bunch of dependencies and reverse engineer someone's code. With an effort to
eliminate duplicate code and make life easier for all developers, we can now use
@objectivehtml
objectivehtml / gist:1478635
Created December 14, 2011 21:29
A better way to fetch EE parameters
private function param($param, $default = FALSE, $boolean = FALSE, $required = FALSE)
{
$name = $param;
$param = $this->EE->TMPL->fetch_param($param);
if($required && !$param) show_error('You must define a "'.$name.'" parameter in the '.__CLASS__.' tag.');
if($param === FALSE && $default !== FALSE)
{
$param = $default;
@objectivehtml
objectivehtml / gist:1534699
Created December 29, 2011 15:56
Simple EE Class interacting with Channel Data
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email_Template {
public $to,
$from,
$cc,
$bcc,
$channel_id,
$categories,
@objectivehtml
objectivehtml / gist:1565549
Created January 5, 2012 14:47
Using Google Maps for ExpressionEngine with an accordion
<!-- This goes in the document HEAD and will add an additional click event to the objects with a class of 'trigger' -->
<script type="text/javascript">
/* By using the $(document).ready() function, we can ensure this JavaScript gets loaded after all the global map variables are set. */
$(document).ready(function() {
$('.trigger').click(function() {
var $t = $(this);
@objectivehtml
objectivehtml / gist:1607083
Created January 13, 2012 15:53
A simpe date comparison utility
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Simple Date Formatting Plugin
*
* @package ExpressionEngine
* @category Plugin
* @author Justin Kimbrell
* @copyright Copyright (c) 2012, Justin Kimbrell
* @link http://objectivehtml.com/
@ziadoz
ziadoz / awesome-php.md
Last active May 8, 2025 07:37
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@amacneil
amacneil / mod.ee_addon.php
Created March 22, 2012 01:02
Supporting URL_THIRD_THEMES in ExpressionEngine < 2.4 add-ons
<?php
// backwards compabitility for EE < 2.4
defined('URL_THIRD_THEMES') OR define('URL_THIRD_THEMES', $this->EE->config->item('theme_folder_url').'third_party/');
@objectivehtml
objectivehtml / gist:2237902
Created March 29, 2012 14:17
Return channel entries with all the categories grouped in a single category
SELECT GROUP_CONCAT(CONVERT(CONCAT(',', `exp_category_posts`.`cat_id`), CHAR(8)) SEPARATOR ' ') as `category_ids`
FROM `exp_channel_data`
LEFT JOIN `exp_category_posts` ON `exp_channel_data`.`entry_id` = `exp_category_posts`.`entry_id`
LEFT JOIN `exp_channel_titles` ON `exp_channel_data`.`entry_id` = `exp_channel_titles`.`entry_id`
GROUP BY `exp_channel_data`.`entry_id`
HAVING `category_ids` LIKE '%,10 %' AND `category_ids` LIKE '%,1 %'
LIMIT 0 , 30
@objectivehtml
objectivehtml / gist:2595553
Created May 4, 2012 15:34
Safecracker HTML5 Attributes Extensions
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ExpressionEngine - by EllisLab
*
* @package ExpressionEngine
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2003 - 2011, EllisLab, Inc.
* @license http://expressionengine.com/user_guide/license.html
* @link http://expressionengine.com
@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);