• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Templates don’t need to break the browser by Nikolas Martens
 

Templates don’t need to break the browser by Nikolas Martens

on

  • 280 views

Despite the fact that most templates in web application are HTML documents, modern template engines are strictly text-manipulating, relying on specific mark-up. Although this makes them universally ...

Despite the fact that most templates in web application are HTML documents, modern template engines are strictly text-manipulating, relying on specific mark-up. Although this makes them universally usable, it also imposes a burden by requiring extra tools to render a template, while making it unreadable for a common tool specialized in mark-up parsing: the browser.
In my talk, I’m proposing an approach to writing templates for web applications that leverages the capabilities of HTML to create highly maintainable templates by requiring no tools besides the browser for development and testing.

Statistics

Views

Total Views
280
Views on SlideShare
278
Embed Views
2

Actions

Likes
0
Downloads
6
Comments
0

1 Embed 2

http://berlin.codemotionworld.com 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Templates don’t need to break the browser by Nikolas Martens  Templates don’t need to break the browser by Nikolas Martens Presentation Transcript

    • <h1>There are no messages</h1><?php if($db->fetchOne(select count(*) from messages)) { ?><?php $messages = $db->fetchAll(select * from messages); ?><h1>There are <?php echo count($messages); ?> messages:<h1><ul><li>From <?php echo $message[from]; ?></li><?php foreach ($messages as $message) { ?><?php } ?></ul><?php } else { ?><php } ?>
    • <h1>There are no messages</h1><?php if($db->fetchOne(select count(*) from messages)) { ?><?php $messages = $db->fetchAll(select * from messages); ?><h1>There are <?php echo count($messages); ?> messages:<h1><ul><li>From <?php echo $message[from]; ?></li><?php foreach ($messages as $message) { ?><?php } ?></ul><?php } else { ?><php } ?>
    • <h1>There are no messages</h1><?php if($db->fetchOne(select count(*) from messages)) { ?><?php $messages = $db->fetchAll(select * from messages); ?><h1>There are <?php echo count($messages); ?> messages:<h1><ul><li>From <?php echo $message[from]; ?></li><?php foreach ($messages as $message) { ?><?php } ?></ul><?php } else { ?><php } ?>
    • <h1>There are no messages</h1><?php if($db->fetchOne(select count(*) from messages)) { ?><?php $messages = $db->fetchAll(select * from messages); ?><h1>There are <?php echo count($messages); ?> messages:<h1><ul><li>From <?php echo $message[from]; ?></li><?php foreach ($messages as $message) { ?><?php } ?></ul><?php } else { ?><php } ?>
    • <h1>There are no messages</h1><? if (count($messages)) { ?><h1>There are <?= count($messages) ?> messages:<h1><ul><li>From <?= $message[from]; ?></li><? foreach ($messages as $message) { ?><?php } ?></ul><? } else { ><php } ?><? $messages = $messageStore->getAll(); ?>
    • <h1>There are no messages</h1><? if (count($messages)) { ?><h1>There are <?= count($messages) ?> messages:<h1><ul><li>From <?= $message[from]; ?></li><? foreach ($messages as $message) { ?><?php } ?></ul><? } else { ><php } ?><? $messages = $messageStore->getAll(); ?>
    • <h1>There are no messages</h1><? if (count($messages)) { ?><h1>There are <?= count($messages) ?> messages:<h1><ul><li>From <?= $message[from]; ?></li><? foreach ($messages as $message) { ?><?php } ?></ul><? } else { ><php } ?><? $messages = $messageStore->getAll(); ?>
    • <? $messages = $store->getMessages();messageCount => count($messages),messages => $messages$model = array(); ?><h1>There are no messages</h1>{{^messageCount}}<h1>There are {{messageCount}} messages:<h1><ul><li>From {{from}}</li>{{#messages}}{{/messages}}</ul>{{/messageCount}}{{#messageCount}}{{/messageCount}}
    • <? $messages = $store->getMessages();messageCount => count($messages),messages => $messages$model = array(); ?><h1>There are no messages</h1>{{^messageCount}}<h1>There are {{messageCount}} messages:<h1><ul><li>From {{from}}</li>{{#messages}}{{/messages}}</ul>{{/messageCount}}{{#messageCount}}{{/messageCount}}
    • <? $messages = $messageStore->getAll(); ?><h1>There are no messages</h1><? if (count($messages)) { ?><h1>There are <?= count($messages) ?> messages:<h1><ul><li>From <?= $message[from]; ?></li><? foreach ($messages as $message) { ?><?php } ?></ul><? } else { ><php } ?><h1>There are no messages</h1>{{^messageCount}}{{/messageCount}}<h1>There are {{messageCount}} messages:<h1><ul><li>From {{from}}</li>{{#messages}}{{/messages}}</ul>{{#messageCount}}{{/messageCount}}
    • <? $messages = $messageStore->getAll(); ?><h1>There are no messages</h1><? if (count($messages)) { ?><h1>There are <?= count($messages) ?> messages:<h1><ul><li>From <?= $message[from]; ?></li><? foreach ($messages as $message) { ?><?php } ?></ul><? } else { ><php } ?><h1>There are no messages</h1>{{^messageCount}}{{/messageCount}}<h1>There are {{messageCount}} messages:<h1><ul><li>From {{from}}</li>{{#messages}}{{/messages}}</ul>{{#messageCount}}{{/messageCount}}
    • { date: 2010-05-10,slot: 9h - 14h }bookings: [],{ name: April… }months: [] ...
    • { date: 2010-05-10,slot: 9h - 14h }bookings: [],{ name: April… }months: [] ...
    • <div>Name: <span>John Wayne</span>Homepage: <a href="http://johnwayne.com"><span>johnwayne.com</span></a></div>
    • <div>Name: <span>John Wayne</span>Homepage: <a href="http://johnwayne.com"><span>johnwayne.com</span></a></div>{person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}
    • <div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>{person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}
    • {person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}<div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • {person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}<div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • {person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}<div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • {person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}<div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • {person: {name: "John Wayne",url : {href: "http://johnwayne.com",caption: "johnwayne.com"}}}<div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • <div property="person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div>
    • <div property="person" typeof="Person">Name: <span property="name">John Wayne</span>Homepage: <a property="url" href="http://johnwayne.com"><span property="caption">johnwayne.com</span></a></div><div vocab="http://schema.org/"></div>