Skip to content

Instantly share code, notes, and snippets.

@litzinger
litzinger / gist:3124799
Created July 16, 2012 20:23 — forked from delamedia/gist:3124739
PHP in Events
<?php
$_GET['cal_id'] = (isset($_GET['cal_id'])) ? $_GET['cal_id'] : array();
$_GET['event_id'] = (isset($_GET['event_id'])) ? $_GET['event_id'] : array();
?>
<?php if( empty($_GET['cal_id']) ) : ?>
{!-- the links from the old site didn't use cal_id or event_id. this will preserve their functionality --}
{if segment_3}
{exp:calendar:calendars calendar_name="{segment_3}" }
{redirect="events/detail/{calendar_url_title}?cal_id={calendar_id}"}
@litzinger
litzinger / pi.suggested.php
Created July 23, 2012 19:25
Wild card search for possible related entries. Good for 404 pages.
<?php
$plugin_info = array(
'pi_name' => 'Suggested Results',
'pi_version' => '1.0',
'pi_author' => 'Brian Litzinger',
'pi_author_url' => '',
'pi_description' => 'Looks at the URL segments and tries to find suggested alternate pages.',
'pi_usage' => Suggested::_usage()
);
@litzinger
litzinger / pi.rest.php
Created July 26, 2012 19:41
Hooks added to REST module so pagination can be added to it via another extension
--- pi.rest.php (106)
+++ pi.rest.php (107)
@@ -90,6 +90,16 @@
{
$this->EE->TMPL->_match_date_vars($this->EE->TMPL->tagdata);
+ /* -------------------------------------------
+ /* 'rest_result' hook.
+ /* - Modify result array
+ */
@litzinger
litzinger / something.html
Created July 27, 2012 02:06
Translation weirdness
{exp:stash:set_value name="current_page_channel" value="pages"}
{exp:stash:set_value name="show_navigation" value="{page_show_sidebar_nav}"}
{exp:stash:set_value name="navigation_tree" value="{page_sidebar_show_tree}"}
{exp:stash:set_value name="sidebar_title" value="{page_sidebar_title}"}
{exp:stash:set_value name="sidebar_title_icon" value="{page_sidebar_title_icon}"}
{exp:stash:set_value name="current_page_entry_id" value="{entry_id}"}
@litzinger
litzinger / mod.calendar.php
Created July 31, 2012 18:49
Modify Calendar module to support custom pagination hook
<?php
// ~ line 1548 of mod.calendar.php
//--------------------------------------------
// pagination for the events tag
//--------------------------------------------
// any tags using this might have different needs
// so we only want to paginate for original events
// tag usage
//--------------------------------------------
<input type="hidden" name="elqCustomerGUID" value="" /> {!-- Auto-populated by Eloqua --}
<input type="hidden" name="elqFormName" value="ResourceLibrary">
<input type="hidden" name="elqSiteID" value="1554" />
<input type="hidden" name="elqCookieWrite" value="0" />
<input type="hidden" name="OmniWebLead" value="1" />
<input type="hidden" name="task_status" value="" />
<input type="hidden" name="member_status" value="Inquiry-High" />
<input type="hidden" name="oid" value="00D300000000Ndm" />
<input type="hidden" name="retURL" value="SFDCID_returnError" /> {!-- SFDCID_action --}
<input type="hidden" name="Primary_Language__c" value="{env:language}" />
@litzinger
litzinger / gist:3343401
Created August 13, 2012 19:15
Get random member in EE
{exp:query sql="select * from exp_members order by rand() limit 1"}
{username}
{/exp:query}
@litzinger
litzinger / gist:3360372
Created August 15, 2012 13:57
server name as global variable
/*
Add this to your config.php file
*/
$default_global_vars = array(
'global:domain_name' => $_SERVER['SERVER_NAME']
);
// Make this global, then add our default_global_vars to the config variables here
global $assign_to_config;
@litzinger
litzinger / pt_pill.js
Created August 16, 2012 02:00
Add disabled functionality to PT Pill
ul.pt-pill { display: inline-block; margin: 5px 0; padding: 0; list-style-type: none; height: 18px; cursor: default; white-space: nowrap;
-webkit-user-select: none; -moz-user-select: none; }
ul.pt-pill li { float: left; margin: 0 -1px 0 0; padding: 0 7px; border: 1px solid #a8b1b3; line-height: 18px; background: #fff url(../images/option_bg.gif) repeat-x; cursor: pointer; }
ul.pt-pill li:first-child { -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; -moz-border-radius: 3px 0 0 3px; }
ul.pt-pill li:last-child { -webkit-border-top-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; -moz-border-radius: 0 3px 3px 0; }
ul.pt-pill li.selected { background: #fff; position: relative; z-index: 1; text-shadow: 0 1px #fff; cursor: default;
background: url(../images/selected_bg.gif) repeat-x;
@litzinger
litzinger / gist:3370382
Created August 16, 2012 14:12 — forked from objectivehtml/gist:3370357
Interface Builder example
<?php
public function settings()
{
$this->EE->cp->set_right_nav(array(
'&larr; Back to Schemas' => $this->cp_url('schemas'),
));
$fields = array(
'settings' => array(