Skip to content

Instantly share code, notes, and snippets.

@andrewminton
andrewminton / EventTutorial.md
Created December 4, 2012 18:35 — forked from brendo/EventTutorial.md
Symphony Events: A Detailed Look

Forms have been an integral part of any interactive site since the dawn of time, they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted, the website will take 'action' and do something with the data and then provide a user with the result. Symphony provides this logic layer via Events.

This tutorial assumes you have a basic understanding of how Events work in Symphony (if not, this may be a good introduction) and are semi comfortable writing some PHP code. I'll be showing you some of the lesser known features of Symphony Events, including event priority, event chaining and a brief demonstration of how to write a custom Event. The difficulty level progresses as we go through, but with any luck you'll be able to learn a thing or two :)

Getting Started

The Scenario

Our client requires a form that allows a user to submit some details about their new car purchase. Th

<?xml version="1.0" encoding="utf-8" ?>
<data>
<sponsorship-packages>
<section id="6" handle="sponsor-packages">Sponsor Packages</section>
<entry id="52">
<sponsor-categories>
<item id="45" handle="pocket-guide-sponsor" section-handle="sponsor-categories" section-name="Sponsor Categories">Pocket Guide Sponsor</item>
</sponsor-categories>
<maximum-number-of-delegates-per-package handle="1">1</maximum-number-of-delegates-per-package>
<number-of-delegates-per-package handle="2-delegate-passes">2 delegate passes</number-of-delegates-per-package>
<data>
<gallery>
<pagination total-entries="13" total-pages="2" entries-per-page="12" current-page="1"/>
<section id="9" handle="gallery">Gallery</section>
<gallery-name handle="other" value="Other">
<entry id="219">
<gallery-name handle="other">Other</gallery-name>
<gallery/>
<pictures>
<item>
<data>
<entry id="1">
<name>Woop woop</name>
</entry>
<entry id="2">
<name>Woop woop2</name>
</entry>
<entry id="3">
<name>Woop woop3</name>
</entry>
@andrewminton
andrewminton / demo.html
Created October 29, 2012 14:52 — forked from zenlor/demo.html
lazy loader
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='lazyload.js'></script>
<style type='text/css'>
<data>
<remote>
<data>
<preferences>
<sitename>Client - Portfolio</sitename>
<languages>
<entry id="1" handle="english" lang="en">English</entry>
<entry id="2" handle="francais" lang="fr">Francais</entry>
</languages>
<stylesheets>
<?xml version="1.0" encoding="UTF-8"?>
<classList>
<class name="Chemistry 101">
<studentList>
<id>123-45-6789</id>
<id>234-56-7890</id>
<id>345-67-8901</id>
<id>456-78-9012</id>
<id>567-89-0123</id>
</studentList>
<data>
<remote>
<data>
<preferences>
<sitename>Client - Portfolio</sitename>
<languages>
<entry id="1" handle="english" lang="en">English</entry>
<entry id="2" handle="francais" lang="fr">Francais</entry>
</languages>
<stylesheets><entry id="1"><url link="http://link-to-main.stylesheet.css"/></entry></stylesheets>
<data>
<smorgasbord-portfolio>
<pagination total-entries="19" total-pages="3" entries-per-page="7" current-page="1" />
<section id="27" handle="smorgasbord-portfolio">Smorgasbord Portfolio</section>
<entry id="416">
<title handle="twenty8twelve-new">Twenty8Twelve/NEW</title>
<description mode="formatted" handle="twenty8twelve-is-a-global-fashion-brand-with-three-stand-alone-boutiques-in-london-the-brand-is-also-sold-in-over-300-carefully-selected-retailers-in-more-than-20-countries-worldwide-each-season-new-characters-inspire-the-designers-to-evolve-the-collectio" word-count="45"><p>Twenty8Twelve is a global fashion brand with three stand-alone boutiques in London. The brand is also sold in over 300 carefully selected retailers in more than 20 countries worldwide. Each season new characters inspire the designers to evolve the collection to a new level, offering wardrobe.</p></description>
<images field-id="122" subsection-id="26" items="4">
<item id="471">
<ti
<data>
<smorgasbord-portfolio>
<pagination total-entries="19" total-pages="3" entries-per-page="7" current-page="1" />
<section id="27" handle="smorgasbord-portfolio">Smorgasbord Portfolio</section>
<entry id="416">
<title handle="twenty8twelve-new">Twenty8Twelve/NEW</title>
<description mode="formatted" handle="twenty8twelve-is-a-global-fashion-brand-with-three-stand-alone-boutiques-in-london-the-brand-is-also-sold-in-over-300-carefully-selected-retailers-in-more-than-20-countries-worldwide-each-season-new-characters-inspire-the-designers-to-evolve-the-collectio" word-count="45"><p>Twenty8Twelve is a global fashion brand with three stand-alone boutiques in London. The brand is also sold in over 300 carefully selected retailers in more than 20 countries worldwide. Each season new characters inspire the designers to evolve the collection to a new level, offering wardrobe.</p></description>
<images field-id="122" subsection-id="26" items="4">
<item id="471">
<ti