Skip to content

Instantly share code, notes, and snippets.

@nathanpitman
nathanpitman / Auto Store SKU
Created March 28, 2014 16:23
Automatically populates the Expresso Store SKU field with the corresponding entry_id value on save if no custom value is specified.
<?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
var metalSmith = require('metalsmith');
var myPlugin = function(files, metalsmith, done){
/*
files param looks like this
{
'path/to/file.html': {
// yaml front matter data from md file here (foo and whatever)
foo: 'bar',
<?php
/*
EE2 hidden configuration variables
Last updated: Jun 20 2010
Obtain this list by putting print_r($this->EE->config->config); on a PHP-enabled template.
See: http://eeinsider.com/tips/view/config-overrides-for-ee-1-and-2/
*/
@jolantis
jolantis / config.php
Created July 16, 2010 14:16 — forked from eeinsider/config.php
ee2 config.php
<?php
/*
|--------------------------------------------------------------------------
| ExpressionEngine Config Items
|--------------------------------------------------------------------------
|
*/
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
/*
| Helps determine which settings to use based on the current server.
| Add this to the top of the constants.php file just under the
| opening php tag and copy it over everything down to just above
| the 'File Stream Modes' section. Modify the switches below as
| needed, and add as many switches as your setup requires.
*/
switch($_SERVER['HTTP_HOST'])
{
@mrw
mrw / ExpressionEngine 2 Multi-Database Setup.php
Created November 1, 2010 16:00
Inside config/database.php: Use a switch statement and the active group in EE2 to set database information based on which server you're currently accessing.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Multiple if statements, or a switch statement,
// can handle as many environments as you need
if ($_SERVER['HTTP_HOST'] == "local-site.dev") {
$active_group = 'expressionengine';
} else {
$active_group = 'enginehosting';
}
@qur2
qur2 / dynamic-paging-url.xsl
Created September 17, 2011 21:12
For SymphonyCMS, provides dynamic pagination-url to Nick Dunn pagination template. It holds the current URL and params while updating the page.
<xsl:call-template name="pagination">
<xsl:with-param name="pagination" select="pagination" />
<!-- build an url that holds every get params, except the page -->
<xsl:with-param name="pagination-url">
<xsl:value-of select="/data/params/root" />
<xsl:value-of select="/data/params/parent-path" />
<xsl:text>?</xsl:text>
<xsl:for-each select="/data/params/*[contains(name(), 'url-')]">
<xsl:if test="not(name(.) = 'url-page')">
<xsl:value-of select="concat(substring-after(name(), 'url-'), '=', text())" />
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<link rel="stylesheet" href="workspace/assets/style.css"/>
</head>
<body>
<div id="head">
<h1>Title</h1>
</div>
<div id="package">
config.init({
meta: {
title: 'Premier Dental Implant Practices',
name: "Christopher Webb",
homepage: 'http://conspirator.co',
twitter: 'conspirator',
banner: '/* \n' +
' * \tAuthor:\t\t{{meta.name}}\n' +
' * \tWebsite:\t{{meta.homepage}}\n' +
' * \tTwitter:\thttp://twitter.com/{{meta.twitter}}\n' +
@brendo
brendo / event.google_calendar_import.php
Created March 29, 2012 14:05
Google Calendar Event
<?php
require_once EXTENSIONS . '/xmlimporter/extension.driver.php';
require_once EXTENSIONS . '/google_calendar_api/lib/class.json_to_xml.php';
require_once TOOLKIT . '/class.gateway.php';
Class eventgoogle_calendar_import extends Event {
const ROOTELEMENT = 'google-calendar-import';
const GOOGLE_ENDPOINT = 'https://www.googleapis.com/calendar/v3/calendars/%s/events?fields=%s&key=%s';