Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Caret Introduction

810 views

Published on

A ultra-minimal introduction to caret, my new web framework. http://www.jeffology.net/go/^caret

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Caret Introduction

  1. 1. ^, a self compiling PHP framework
  2. 2. Intro. jeff = meta programmer
  3. 3. I want my life (and the lives of my coworkers) to be … nice. So I search for the silver bullet. ^ is my latest creation. (yet another PHP web framework)
  4. 4. ^ is a simplified model of modern web practices written for basic PHP (with no OOP). (basically is pure PHP with special hokey-pokey comments)
  5. 5. Introducing the “Topology Compiler”
  6. 6. page.user.php <?php /*:[url1=users]:*/ /*:[url2=users/%id]:*/ /*:[url3=users/%id/%mode]:*/ /*:[url4=user-profile/%id/%first/%last]:*/ ?><html>...do stuff with $_REQUEST...</html> /users?id=123&mode=edit = /users/123/edit /users?id=123&first=Jeffrey&last=Barber = /uses-profile/123/Jeffrey/Barber
  7. 7. Linking <a href=”<? HrefGo(“page.user.php”,array('id' => '1')); ?> View User 1</a> <a href=”<? HrefGo(“page.user.php”,array('id' => '1','mode' => 'edit')); ?> Edit User 1</a> <a href=”<? HrefGo(“page.user.php”,array('mode' => 'edit') + $_REQUEST); ?> Edit Current User </a>
  8. 8. Poof! SEO urls that will make your marketing guru swoon!!!!
  9. 9. How it works? http://code.google.com/p/caret/ It's open source!
  10. 10. if(!isset($_GET['_do_not_compile'])) { // Compile exec(&quot;./^compiler/step.1.sh > ^obj/__temp.js&quot;); exec(&quot;js ^obj/__temp.js > ^obj/sitemap.php&quot;); exec(&quot;./^compiler/step.2.sh > ^obj/__temp.js&quot;); exec(&quot;js ^obj/__temp.js > ^obj/router.php&quot;); exec(&quot;cat ^src/web.model.php ^compiler/engine.php ^obj/router.php > ^e.php&quot;); } include(&quot;^e.php&quot;); // did you just vomit a little on the inside? I did
  11. 11. Development: RewriteEngine on RewriteRule ^[a-zA-Z](.*) ^c.php/$0 RewriteRule ^$ ^c.php/ Production: RewriteEngine on RewriteRule ^[a-zA-Z](.*) ^e.php/$0 RewriteRule ^$ ^e.php/

×