Skip to content

Instantly share code, notes, and snippets.

View jbroadway's full-sized avatar

John de Plume jbroadway

View GitHub Profile
@jbroadway
jbroadway / README.md
Created May 24, 2012 17:59
Elefant demo site setup

The demo site is controlleed by two handlers in the apps/demo app:

  • demo/index - Creates a new user when you visit /demo and logs them in
  • demo/reset - Resets the database and files via cron

The files that are modified are:

  • apps/demo - Demo handlers
  • apps/admin/css/admin.css - Added styles for demo reset notice
  • css/mobile.css - Added styles for demo reset notice
@jbroadway
jbroadway / Slimdown.md
Last active August 20, 2025 13:12
Slimdown - A simple regex-based Markdown parser.
@jbroadway
jbroadway / elefant_compiled.php
Created June 7, 2012 14:09
PHP cached template comparison
<h1><?php echo Template::sanitize ($data->title, 'UTF-8'); ?></h1>
<?php if ($data->show_people) { ?>
<ul>
<?php foreach ($data->people as $data->loop_index => $data->loop_value) { ?>
<li><?php echo Template::sanitize ($data->loop_value, 'UTF-8'); ?></li>
<?php } ?>
</ul>
<?php } ?>
@jbroadway
jbroadway / api.js
Created June 27, 2012 17:52
API wrapper example for use with Elefant's Restful class
// the api for accessing the site
var api = (function ($) {
var self = {};
// the prefix for api requests
self.prefix = '/myapi/v1/';
// enable/disable debugging output to the console
self.debug = false;
@jbroadway
jbroadway / app.js
Created June 27, 2012 18:05
Simple History.js-based client-side router
var app = (function ($) {
var self = {};
// change pages via app.go('/new/page') or app.go(-1)
self.go = function (url) {
if (url === parseInt (url)) {
History.go (url);
} else {
History.pushState (null, null, url);
}
@jbroadway
jbroadway / postswithicons.html
Created October 11, 2012 14:53
Elefant CMS - Blog headlines with icons
{% if dates %}
{! admin/util/dates !}
{% end %}
<ul>
{% foreach posts %}
<li>
{% if dates %}{{ loop_value->ts|I18n::short_date }} {% end %}
<a href="/blog/post/{{ loop_value->id }}/{{ loop_value->title|URLify::filter }}">
<img src="{{ loop_value->img }}" />
@jbroadway
jbroadway / listresults.html
Created October 12, 2012 16:09
Elefant CMS - Browse form submissions
<p><a href="/form/new=entry">{" All forms "}</a> | <a href="/form/export?id={{ id }}">{" Export results (CSV) "}</a></p>
{% if offset > 0 %}
<p class="previous"><a href="/form/results?id={{ id }}&offset={{ prev }}">&laquo; {"Previous"}</a></p>
{% end %}
<p>
<table width="100%">
<tr>
<th width="10%">{" Submitted "}</th>
@jbroadway
jbroadway / navigation.json
Created November 20, 2012 16:08
Example navigation
[
{
"data":"Home",
"attr":{
"id":"index",
"classname":""
}
},
{
"data":"About",
@jbroadway
jbroadway / const.html
Created December 6, 2012 16:46
Elefant CMS sub-expression quote test
<!-- apps/test/views/const.html -->
{! navigation/section?section=[constant('HOMEPAGE')] !}
@jbroadway
jbroadway / fix_redirect_issue.patch
Created January 7, 2013 16:52
Potential fix for redirect causing emails to fail.
diff --git a/handlers/index.php b/handlers/index.php
index f3d44b3..933175c 100644
--- a/handlers/index.php
+++ b/handlers/index.php
@@ -51,6 +51,10 @@ if ($f->submit ()) {
}
}
+ // if there's a redirect, we wait to exit after
+ // all actions have been performed.