Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Perch CMS Template Engine

Drew McLellan
September 10, 2013

Perch CMS Template Engine

How we wrote a template engine for Perch CMS

Drew McLellan

September 10, 2013
Tweet

More Decks by Drew McLellan

Other Decks in Technology

Transcript

  1. Drew McLellan Perch CMS grabaperch.com -HOW WE WROTE A- TEMPLATE

    ENGINE RDG Geek Night 10th September 2013
  2. L I G H T W E I G H

    T PHP CMS FOR SMALL WEBSITES
  3. <h2><perch:content id="heading" type="text" label="Heading" required="true" title="true" /></h2> <p class="date"><perch:content id="date"

    type="date" label="Date" format="%d %B %Y" /></p> <perch:content id="body" type="textarea" label="Body" textile="true" editor="markitup" required="true" />
  4. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  5. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  6. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  7. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  8. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  9. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! <perch:if exists=”c”> !

    ! ! Hello, world. ! ! </perch:if> ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  10. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! ! ! !

    Hello, world. ! ! ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>
  11. <perch:if exists=”a”> ! <perch:if exists=”b”> ! ! ! ! !

    Hello, world. ! ! ! </perch:if> <perch:else /> ! <perch:if exists=”d”> ! ! Goodbye, cruel world. ! </perch:if> </perch:if>