Skip to content

Instantly share code, notes, and snippets.

@Rayne
Created July 24, 2014 23:03
Show Gist options
  • Save Rayne/ebd6f5a34fb49cc000bb to your computer and use it in GitHub Desktop.
Save Rayne/ebd6f5a34fb49cc000bb to your computer and use it in GitHub Desktop.
<?php
// […]
$f3->route('GET /tpl', function($f3) {
$f3->set('posts.0.date', 'DATE');
$f3->set('posts.0.title', 'TITLE');
$f3->set('posts.0.title_slug', 'TITLE_SLUG');
$f3->set('posts.0.text', 'TEXT');
echo Template::instance()->render('./template.html');
});
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Blog title</title>
<link>http://127.0.0.1/tpl</link>
<description>534f.de Blog</description>
<pubDate>DATE</pubDate>
<item>
<title>TITLE</title>
<link>http://127.0.0.1/tpl/TITLE_SLUG</link>
<description>TEXT</description>
</item>
</channel>
</rss>
<!DOCTYPE html>
<html>
<head><title>Fatal error: syntax error, unexpected 'version' (T_STRING) </title><style>code{word-wrap:break-word;color:black}.comment,.doc_comment,.ml_comment{color:dimgray;font-style:italic}.variable{color:blueviolet}.const,.constant_encapsed_string,.class_c,.dir,.file,.func_c,.halt_compiler,.line,.method_c,.lnumber,.dnumber{color:crimson}.string,.and_equal,.boolean_and,.boolean_or,.concat_equal,.dec,.div_equal,.inc,.is_equal,.is_greater_or_equal,.is_identical,.is_not_equal,.is_not_identical,.is_smaller_or_equal,.logical_and,.logical_or,.logical_xor,.minus_equal,.mod_equal,.mul_equal,.ns_c,.ns_separator,.or_equal,.plus_equal,.sl,.sl_equal,.sr,.sr_equal,.xor_equal,.start_heredoc,.end_heredoc,.object_operator,.paamayim_nekudotayim{color:black}.abstract,.array,.array_cast,.as,.break,.case,.catch,.class,.clone,.continue,.declare,.default,.do,.echo,.else,.elseif,.empty.enddeclare,.endfor,.endforach,.endif,.endswitch,.endwhile,.eval,.exit,.extends,.final,.for,.foreach,.function,.global,.goto,.if,.implements,.include,.include_once,.instanceof,.interface,.isset,.list,.namespace,.new,.print,.private,.public,.protected,.require,.require_once,.return,.static,.switch,.throw,.try,.unset,.use,.var,.while{color:royalblue}.open_tag,.open_tag_with_echo,.close_tag{color:orange}.ini_section{color:black}.ini_key{color:royalblue}.ini_value{color:crimson}.xml_tag{color:dodgerblue}.xml_attr{color:blueviolet}.xml_data{color:red}.section{color:black}.directive{color:blue}.data{color:dimgray}
</style></head>
<body>
<h1></h1>
<p>HTTP Fatal error: syntax error, unexpected 'version' (T_STRING) (GET /tpl)</p>
<pre></pre>
</body>
</html>
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Blog title</title>
<link>{{@REALM}}</link>
<description>534f.de Blog</description>
<pubDate>{{@posts.0.date}}</pubDate>
<item>
<repeat group="{{@posts}}" value="{{@post}}">
<title>{{@post.title}}</title>
<link>{{@REALM}}/{{@post.title_slug}}</link>
<description>{{implode(' ', array_slice(explode(' ', @post.text), 0, 10))}}</description>
</repeat>
</item>
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment