Skip to content

Instantly share code, notes, and snippets.

View objectivehtml's full-sized avatar

Justin Kimbrell objectivehtml

View GitHub Profile
@objectivehtml
objectivehtml / gist:3784945
Created September 25, 2012 22:51
Get filename from URL
/(((.|\n)*)[\/$])|(\.(.|\n)*)/g
@objectivehtml
objectivehtml / gist:3761912
Created September 21, 2012 14:48
Manipulate the no_results tag
// Add this to your module tag
if($no_results_prefix = $this->EE->TMPL->fetch_param('no_results_prefix'))
{
if(preg_match('/\\'.LD.'if '.$no_results_prefix.'no_results\\'.RD.'.*\\'.LD.'\\/if\\'.RD.'/us', $this->EE->TMPL->tagdata, $matches))
{
$this->EE->TMPL->no_results = $this->EE->TMPL->parse_variables_row($matches[0], array(
$no_results_prefix.'no_results' => 1
));
}
@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: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: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
@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/');
@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.
@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/
@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: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,