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:1330823
Created November 1, 2011 15:32
Basic usage of Google Maps inside a Channel Entries tag
{exp:gmap:init id="map" class="map" style="width:500px;height:400px"}
{exp:channel:entries [your channel parameters]}
<!-- If you are using coordinates -->
{exp:gmap:marker id="map" latitude="{your_lat_field_name}" longitude="{your_lng_field_name}"}{title}{/exp:gmap:marker}
<!-- If you are using a Gmap fieldtype -->
{exp:gmap:marker id="map" lat_lng="{your_gmap_field_name}"}{title}{/exp:gmap:marker}
Possible syntax:
$this->EE->channel_data->api->module_name->module_method();
Or...
$this->EE->channel_data_api->module_name->module_method();
Example:
{exp:gmap:init id="map" class="map"}
{exp:super_search:results channel="home" parse="inward"}
{exp:gmap:marker id="map" lat_lng="({home_latitude},{home_longitude})" show_one_window="true"}{title}{/exp:gmap:marker}
{/exp:super_search:results}
@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
<?php
if ($EE_view_disable !== TRUE)
{
$this->load->view('_shared/header');
$this->load->view('_shared/main_menu');
$this->load->view('_shared/sidebar');
$this->load->view('_shared/breadcrumbs');
}
?>
/* tabs */
$(function(){
$(".css-tabs").tabs(".css-panes > .pane-content");
$(".css-tabs a").click(function(){
var $t = $(this);
var href = $t.attr("href");
if (href == "#map") {
@objectivehtml
objectivehtml / gist:1383171
Created November 21, 2011 16:40
Basic Google Maps for EE fieldtype usage example
{exp:gmap:init id="map" style="width:400px;height:300px"}
{exp:channel:entries [your params here]}
{exp:gmap:marker id="map" lat_lng="{your_gmap_field_name}"}
{title}
{/exp:gmap:marker}
{/exp:channel:entries}
@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);