Slide 1

Slide 1 text

Drew McLellan Perch CMS grabaperch.com -HOW WE WROTE A- TEMPLATE ENGINE RDG Geek Night 10th September 2013

Slide 2

Slide 2 text

L I G H T W E I G H T PHP CMS FOR SMALL WEBSITES

Slide 3

Slide 3 text

WE NEEDED A REALLY GOOD TEMPLATE LANGUAGE

Slide 4

Slide 4 text

-SO- W H A T W A S ALREADY OUT THERE?

Slide 5

Slide 5 text

SMARTY (NOT SO SMART)

Slide 6

Slide 6 text

TWIG (NOT SO MATURE)

Slide 7

Slide 7 text

JUST PHP -WITH A- DIFFERENT S Y N T A X

Slide 8

Slide 8 text

!

Slide 9

Slide 9 text

Slide 10

Slide 10 text

HTML IS LIKE X M L RIGHT?

Slide 11

Slide 11 text

" />

Slide 12

Slide 12 text

xkcd.com/208

Slide 13

Slide 13 text

stackoverflow.com/questions/1732348/

Slide 14

Slide 14 text

! #]*/>#

Slide 15

Slide 15 text

$Tag = new PerchXMLTag( ''); echo $Tag->bar; // baz

Slide 16

Slide 16 text

#([a-z-]*)="([^"]*)"#

Slide 17

Slide 17 text

#([a-z-]+)=[\"]([^\"\\ \\]*(?:\\\\.[^\"\\\ \]*)*)[\"]#

Slide 18

Slide 18 text

-WAIT- REGULAR EXPRESSIONS ARE SLOW, RIGHT?

Slide 19

Slide 19 text

REGEX ARE SLOW UNLESS YOU NEED THEM

Slide 20

Slide 20 text

#(]*>)(((?! perch:if).)*)# ! ! ! ... loadsamarkup ... !

Slide 21

Slide 21 text

-WE NEEDED- A NEW WAY -TO PARSE- TAG PAIRS

Slide 22

Slide 22 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 23

Slide 23 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 24

Slide 24 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 25

Slide 25 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 26

Slide 26 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 27

Slide 27 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 28

Slide 28 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 29

Slide 29 text

! ! ! ! ! ! Hello, world. ! ! ! ! ! ! Goodbye, cruel world. !

Slide 30

Slide 30 text

CLOSING TAGS -ARE - EASY

Slide 31

Slide 31 text

NO MORE WINDOWS CRASHES

Slide 32

Slide 32 text

MAYBE - WE WILL - REWRITE IT

Slide 33

Slide 33 text

THANK YOU Perch is at grabaperch.com On most things, I’ am @ drewm