Upload
codemotion
View
235
Download
2
Embed Size (px)
DESCRIPTION
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.
Citation preview
<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>