Skip to content

Instantly share code, notes, and snippets.

View juriansluiman's full-sized avatar

Jurian Sluiman juriansluiman

View GitHub Profile
@juriansluiman
juriansluiman / 1. Actions.html
Created November 26, 2011 20:24
jQuery plugin for modal dialogs
<!--
First use case: ask for a confirmation before requesting the uri in the hyperlink
Everything works with html5 data attributes. Possible options:
* data-template: id in dom or uri for contents of modal. This attribute is required
* data-title: title of the modal
* data-method: specify a GET or POST request, defaults to GET
* data-submit: specify the label of the button to continue to the link, defaults to "Submit"
* data-cancel: specify the label of the button to cancel the modal, defaults to "Cancel"
* data-* : every other attribute can be used to replace keys in the template
@juriansluiman
juriansluiman / 1. Wrapper.phtml
Created November 25, 2011 15:11
Three step based view
<?php echo $this->doctype() ?>
<html>
<head>
<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headScript() ?>
</head>
@juriansluiman
juriansluiman / 1. Application.md
Created November 8, 2011 14:35
Modular application system for ZF2

Application system

This document describes how a system can be formed to set up modules in combination with a tree of pages stored in the database. The general idea is to have pages stored within a database in a tree structure, where every page is coupled to a module (1:n). Pages are queried and parsed to routes as a combination of the page route and the modules route(s).

Goal

Webapplications exist often with a frontend (for normal visitors) and backend (to manage the whole bunch). Also some pages might want to utilize the same module (two simple text pages as basic example). Thirdly, it should be easy for end users to create new pages, modify them or delete pages. To accomplish this, a robust system ("content management framework") should be made on top of zf2 to accomodate this.

Configuration

@juriansluiman
juriansluiman / Barcode.php
Created October 27, 2011 07:18
Barcode view helper
<?php
class Soflomo_View_Helper_Barcode extends Zend_View_Helper_Abstract
{
public function barcode ($text, $type = 'code128', $options = array())
{
$options = array('text' => $text) + $options;
$resource = Zend_Barcode::draw(
$type, 'image', $options, array()
);
@juriansluiman
juriansluiman / IndexController.php
Created October 14, 2011 08:31
IndexController with "preDispatch" event simulation
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\ActionController
Zend\Mvc\MvcEvent;
class IndexController extends ActionController
{
public function indexAction()