Volt模æ¿å¼•擎 ===================== Volt是一个超快速和设计者å‹å¥½çš„æ¨¡æ¿è¯è¨€ï¼ŒCè¯è¨€ç¼–写的PHP。它为您æä¾›äº†ä¸€å¥— 助ç†å†™ä¸€ä¸ªç®€å•的方法的æ„è§ã€‚伿³•尔康与其他组件的高度集æˆï¼Œ å°±åƒä½ å¯ä»¥ä½¿ç”¨å®ƒä½œä¸ºä¸€ä¸ªç‹¬ç«‹çš„ç»„ä»¶åœ¨ä½ çš„åº”ç”¨ç¨‹åºä¸ã€‚ Volt是一ç§ç”¨Cè¯è¨€ç¼–写的超快速并且设计å‹å¥½çš„PHP模æ¿å¼•æ“Žï¼Œå®ƒä¸ºä½ æä¾›äº†ä¸€å¥—很方便的视图助手。Volt与其他的组件高度集æˆï¼Œå°±åƒä½ å¯ä»¥åœ¨åº”用程åºä¸å•ç‹¬ä½¿ç”¨å®ƒä¸€æ ·ã€‚ .. figure:: ../_static/img/volt.jpg :align: center Voltçš„çµæ„Ÿæ¥æºäºŽ Twig_ 。最åˆç”±Armin Ronacheråˆ›å»ºï¼Œè€Œå®ƒåˆ™æ˜¯å— Jinja_ çš„å¯å‘。 å› æ¤ï¼Œè®¸å¤šå·²ç»åœ¨ä½¿ç”¨Twig的开å‘人员将熟练的使用相åŒçš„è¯æ³•。Voltçš„è¯æ³•å’ŒåŠŸèƒ½æ›´ä¸ºå¼ºå¤§ï¼Œæ›´å¤šçš„å…ƒç´ ä»¥åŠæ›´å¼ºçš„æ€§èƒ½ã€‚ Volt被编译æˆPHP代ç ï¼Œå› æ¤åŸºæœ¬ä¸Šçœå´äº†æ‰‹åŠ¨ç¼–å†™PHP代ç ,实现了业务逻辑与视图分离: .. code-block:: html+jinja {# app/views/products/show.volt #} {% block last_products %} {% for product in products %} * Name: {{ product.name|e }} {% if product.status == "Active" %} Price: {{ product.price + product.taxes/100 }} {% endif %} {% endfor %} {% endblock %} 激活 Volt --------------- ä½œä¸ºä¸€ç§æ¨¡æ¿å¼•æ“Žï¼Œä½ éœ€è¦æŠŠVolt注册到视图组件,并设置一个扩展å称或者使用默认的扩展å .phtml : .. code-block:: php <?php //Registering Volt as template engine $di->set('view', function() { $view = new \Phalcon\Mvc\View(); $view->setViewsDir('../app/views/'); $view->registerEngines(array( ".volt" => 'Phalcon\Mvc\View\Engine\Volt' )); return $view; }); 使用默认的 ".phtml" 作为扩展å称: .. code-block:: php <?php $view->registerEngines(array( ".phtml" => 'Phalcon\Mvc\View\Engine\Volt' )); 基本使用方法 ----------------------- Voltçš„ä»£ç æ˜¯ç”±PHPå’ŒHTMLæž„æˆã€‚Volt䏿œ‰ä¸€ç»„特殊的分隔符,{% ... %} ç”¨æ¥æ‰§è¡Œå¾ªçޝè¯å¥æˆ–æ¡ä»¶åˆ¤æ–ç‰ï¼Œèµ‹å€¼è¯å¥ä½¿ç”¨ {{ ... }}。 䏋颿˜¯ä¸€ä¸ªå°ç¤ºä¾‹ï¼Œç”¨äºŽè¯´æ˜Žä¸€äº›åŸºæœ¬çš„功能: .. code-block:: html+jinja {# app/views/posts/show.phtml #} <!DOCTYPE html> <html> <head> <title>{{ title }} - A example blog</title> </head> <body> {% if show_navigation %} <ul id="navigation"> {% for item in menu %} <li><a href="{{ item.href }}">{{ item.caption }}</a></li> {% endfor %} </ul> {% endif %} <h1>{{ post.title }}</h1> <div class="content"> {{ post.content }} </div> </body> </html> ä½ å¯ä»¥ä½¿ç”¨ Phalcon\\Mvc\\View::setVar 把控制器ä¸çš„å˜é‡ä¼ 递到视图ä¸ã€‚在å‰é¢çš„例åä¸ï¼Œæœ‰ä¸‰ä¸ªå˜é‡ä¼ 递到视图ä¸ï¼štitle, menu å’Œ post : .. code-block:: php <?php class PostsController extends \Phalcon\Mvc\Controller { public function showAction() { $post = Post::findFirst(); $this->view->setVar("title", $post->title); $this->view->setVar("post", $post); $this->view->setVar("menu", Menu::find()); $this->view->setVar("show_navigation", true); } } å˜é‡ --------- å˜é‡å¯ä»¥æœ‰å±žæ€§ï¼Œå¯ä»¥é€šè¿‡ä½¿ç”¨è¯æ³•访问他们,如:foo.barã€‚å¦‚æžœå®ƒä»¬æ˜¯æ•°ç»„ï¼Œä½ å¯ä»¥ä½¿ç”¨ foo['bar'] 的方å¼è®¿é—®ï¼š .. code-block:: jinja {{ post.title }} {{ post['title'] }} 过滤器 ------- å˜é‡å¯ä»¥ä½¿ç”¨è¿‡æ»¤å™¨æ ¼å¼åŒ–æˆ–ä¿®æ”¹ï¼Œç®¡é“æ“作符 "|" 用于接收过滤器过滤å˜é‡ï¼š .. code-block:: jinja {{ post.title|e }} {{ post.content|striptags }} {{ name|capitalize|trim }} 以下列表是Volt内置的过滤器: +----------------------+------------------------------------------------------------------------------+ | Filter | Description | +======================+==============================================================================+ | e | Applies Phalcon\\Escaper->escapeHtml to the value | +----------------------+------------------------------------------------------------------------------+ | escape | Applies Phalcon\\Escaper->escapeHtml to the value | +----------------------+------------------------------------------------------------------------------+ | trim | Applies the trim_ PHP function to the value. Removing extra spaces | +----------------------+------------------------------------------------------------------------------+ | striptags | Applies the striptags_ PHP function to the value. Removing HTML tags | +----------------------+------------------------------------------------------------------------------+ | slashes | Applies the slashes_ PHP function to the value. Escaping values | +----------------------+------------------------------------------------------------------------------+ | stripslashes | Applies the stripslashes_ PHP function to the value. Removing escaped quotes | +----------------------+------------------------------------------------------------------------------+ | capitalize | Capitalizes a string by applying the ucwords_ PHP function to the value | +----------------------+------------------------------------------------------------------------------+ | lowercase | Change the case of a string to lowercase | +----------------------+------------------------------------------------------------------------------+ | uppercase | Change the case of a string to uppercase | +----------------------+------------------------------------------------------------------------------+ | length | Counts the string length or how many items are in an array or object | +----------------------+------------------------------------------------------------------------------+ | nl2br | Changes newlines \\n by line breaks (<br />). Uses the PHP function nl2br_ | +----------------------+------------------------------------------------------------------------------+ | sort | Sorts an array using the PHP function asort_ | +----------------------+------------------------------------------------------------------------------+ | json_encode | Converts a value into its JSON_ representation | +----------------------+------------------------------------------------------------------------------+ 注释 -------- 在Volt模æ¿ä¸å¯ä»¥ä½¿ç”¨ {# ... #} åˆ†éš”ç¬¦æ·»åŠ æ³¨é‡Šï¼Œä»–ä»¬å†…éƒ¨çš„æ‰€æœ‰æ–‡å—将被忽略: .. code-block:: jinja {# note: this is a comment {% set price = 100; %} #} List of Control Structures -------------------------- Voltæä¾›äº†ä¸€ç»„基本的但功能强大的控制结构: For ^^^ Loop over each item in a sequence. The following example shows how to traverse a set of "robots" and print his/her name: .. code-block:: html+jinja <h1>Robots</h1> <ul> {% for robot in robots %} <li>{{ robot.name|e }}</li> {% endfor %} </ul> for循环嵌套: .. code-block:: html+jinja <h1>Robots</h1> {% for robot in robots %} {% for part in robot.parts %} Robot: {{ robot.name|e }} Part: {{ part.name|e }} <br/> {% endfor %} {% endfor %} If ^^ As PHP, a if statement checks if an expression is evaluated as true or false: .. code-block:: html+jinja <h1>Cyborg Robots</h1> <ul> {% for robot in robots %} {% if robot.type = "cyborg" %} <li>{{ robot.name|e }}</li> {% endif %} {% endfor %} </ul> The else clause is also supported: .. code-block:: html+jinja <h1>Robots</h1> <ul> {% for robot in robots %} {% if robot.type = "cyborg" %} <li>{{ robot.name|e }}</li> {% else %} <li>{{ robot.name|e }} (not a cyborg)</li> {% endif %} {% endfor %} </ul> å˜é‡èµ‹å€¼ ----------- åœ¨æ¨¡æ¿æ–‡ä»¶ä¸ï¼Œå¯ä»¥ä½¿ç”¨ "set" 设置或改å˜å˜é‡çš„值: .. code-block:: html+jinja {% set fruits = ['Apple', 'Banana', 'Orange'] %} {% set name = robot.name %} Expressions ----------- Voltå¯¹è¡¨è¾¾å¼æä¾›äº†ä¸€ç»„åŸºæœ¬çš„æ”¯æŒï¼ŒåŒ…括å—符串以åŠå¸¸ç”¨çš„æ“ä½œï¼š +----------------------+------------------------------------------------------------------------------+ | Filter | Description | +======================+==============================================================================+ | “this is a string†| Text between double quotes or single quotes are handled as strings | +----------------------+------------------------------------------------------------------------------+ | 100.25 | Numbers with a decimal part are handled as doubles/floats | +----------------------+------------------------------------------------------------------------------+ | 100 | Numbers without a decimal part are handled as integers | +----------------------+------------------------------------------------------------------------------+ | false | Constant "false" is the boolean false value | +----------------------+------------------------------------------------------------------------------+ | true | Constant "true" is the boolean true value | +----------------------+------------------------------------------------------------------------------+ | null | Constant "null" is the Null value | +----------------------+------------------------------------------------------------------------------+ Arrays ^^^^^^ æ— è®ºä½ ä½¿ç”¨PHP 5.3 或 5.4ï¼Œä½ éƒ½å¯ä»¥ç”¨ "[ ]" 括起æ¥çš„形弿¥åˆ›å»ºæ•°ç»„: 译者注:如果在PHPæ–‡ä»¶ä¸æƒ³ç”¨è¿™ç§æ–¹å¼åˆ›å»ºæ•°ç»„,PHP最低版本应该为PHP 5.4 .. code-block:: html+jinja {# Simple array #} {{ ['Apple', 'Banana', 'Orange'] }} {# Other simple array #} {{ ['Apple', 1, 2.5, false, null] }} {# Multi-Dimensional array #} {{ [[1, 2], [3, 4], [5, 6]] }} {# Hash-style array #} {{ ['first': 1, 'second': 4/2, 'third': '3'] }} æ•°å¦è®¡ç®—(Math) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ä½ å¯ä»¥åœ¨æ¨¡æ¿æ–‡ä»¶ä¸ç›´æŽ¥ä½¿ç”¨ä»¥ä¸‹æ“作符进行计算: +----------------------+------------------------------------------------------------------------------+ | Operator | Description | +======================+==============================================================================+ | \+ | Perform an adding operation. {{ 2+3 }} returns 5 | +----------------------+------------------------------------------------------------------------------+ | \- | Perform a substraction operation {{ 2-3 }} returns -1 | +----------------------+------------------------------------------------------------------------------+ | \* | Perform a multiplication operation {{ 2*3 }} returns 6 | +----------------------+------------------------------------------------------------------------------+ | \/ | Perform a division operation {{ 10/2 }} returns 5 | +----------------------+------------------------------------------------------------------------------+ | \% | Calculate the remainder of an integer division {{ 10%3 }} returns 1 | +----------------------+------------------------------------------------------------------------------+ 比较è¿ç®—符(Comparisions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 䏋颿˜¯åœ¨æ¨¡æ¿ä¸å¯ç”¨çš„æ¯”较è¿ç®—符: +----------------------+------------------------------------------------------------------------------+ | Operator | Description | +======================+==============================================================================+ | == | Check whether both operands are equal | +----------------------+------------------------------------------------------------------------------+ | != | Check whether both operands aren't equal | +----------------------+------------------------------------------------------------------------------+ | \<\> | Check whether both operands aren't equal | +----------------------+------------------------------------------------------------------------------+ | \> | Check whether left operand is greater than right operand | +----------------------+------------------------------------------------------------------------------+ | \< | Check whether left operand is less than right operand | +----------------------+------------------------------------------------------------------------------+ | <= | Check whether left operand is less or equal than right operand | +----------------------+------------------------------------------------------------------------------+ | >= | Check whether left operand is greater or equal than right operand | +----------------------+------------------------------------------------------------------------------+ | === | Check whether both operands are identical | +----------------------+------------------------------------------------------------------------------+ | !== | Check whether both operands aren't identical | +----------------------+------------------------------------------------------------------------------+ 逻辑è¿ç®—符(Logic) ^^^^^^^^^^^^^^^^^ Logic operators are useful in the "if" expression evaluation to combine multiple tests: +----------------------+------------------------------------------------------------------------------+ | Operator | Description | +======================+==============================================================================+ | or | Return true if the left or right operand is evaluated as true | +----------------------+------------------------------------------------------------------------------+ | and | Return true if both left and right operands are evaluated as true | +----------------------+------------------------------------------------------------------------------+ | not | Negates an expression | +----------------------+------------------------------------------------------------------------------+ | ( expr ) | Parenthesis groups expressions | +----------------------+------------------------------------------------------------------------------+ å…¶ä»–æ“作符(Other Operators) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Additional operators seen the following operators are available: +----------------------+----------------------------------------------------------------------------------------------+ | Operator | Description | +======================+==============================================================================================+ | \~ | Concatenates both operands {{ "hello " \~ "world" }} | +----------------------+----------------------------------------------------------------------------------------------+ | \| | Applies a filter in the right operand to the left {{ "hello"\|uppercase }} | +----------------------+----------------------------------------------------------------------------------------------+ | \.\. | Creates a range {{ 'a'..'z' }} {{ 1..10 }} | +----------------------+----------------------------------------------------------------------------------------------+ | is | Same as == (equals) | +----------------------+----------------------------------------------------------------------------------------------+ | is not | Same as != (not equals) | +----------------------+----------------------------------------------------------------------------------------------+ The following example shows how to use operators: .. code-block:: html+jinja {% set robots = ['Voltron', 'Astro Boy', 'Terminator', 'C3PO'] %} {% for index in 0..robots|length %} {% if isset robots[index] %} {{ "Name: " ~ robots[index] }} {% endif %} {% endfor %} Using Tag Helpers ----------------- Volt é«˜åº¦é›†æˆ :doc:`Phalcon\\Tag <tags>`,å› æ¤ä½ å¯ä»¥åœ¨Volt模æ¿ä¸æ–¹ä¾¿çš„使用它们: .. code-block:: html+jinja {{ javascript_include("js/jquery.js") }} {{ form('products/save', 'method': 'post') }} <label>Name</label> {{ text_field("name", "size": 32) }} <label>Type</label> {{ select("type", productTypes, 'using': ['id', 'name']) }} {{ submit_button('Send') }} </form> 䏋颿˜¯ç”Ÿæˆçš„PHP代ç : .. code-block:: html+php <?php echo Phalcon\Tag::javascriptInclude("js/jquery.js") ?> <?php echo Phalcon\Tag::form(array('products/save', 'method' => 'post')); ?> <label>Name</label> <?php echo Phalcon\Tag::textField(array('name', 'size' => 32)); ?> <label>Type</label> <?php echo Phalcon\Tag::select(array('type', $productTypes, 'using' => array('id', 'name'))); ?> <?php echo Phalcon\Tag::submitButton('Send'); ?> </form> è¦æƒ³åœ¨Volt模æ¿ä¸è°ƒç”¨ Phalcon\Tag åŠ©æ‰‹ï¼Œä½ åªéœ€è¦ä½¿ç”¨å®ƒä»¬åœ¨Voltä¸å¯¹åº”的缩写版本å³å¯ï¼š +------------------------------------+-----------------------+ | Method | Volt function | +====================================+=======================+ | Phalcon\\Tag::linkTo | link_to | +------------------------------------+-----------------------+ | Phalcon\\Tag::textField | text_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::passwordField | password_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::hiddenField | hidden_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::fileField | file_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::checkField | check_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::radioField | radio_field | +------------------------------------+-----------------------+ | Phalcon\\Tag::submitButton | submit_button | +------------------------------------+-----------------------+ | Phalcon\\Tag::selectStatic | select_static | +------------------------------------+-----------------------+ | Phalcon\\Tag::select | select | +------------------------------------+-----------------------+ | Phalcon\\Tag::textArea | text_area | +------------------------------------+-----------------------+ | Phalcon\\Tag::form | form | +------------------------------------+-----------------------+ | Phalcon\\Tag::endForm | end_form | +------------------------------------+-----------------------+ | Phalcon\\Tag::getTitle | get_title | +------------------------------------+-----------------------+ | Phalcon\\Tag::stylesheetLink | stylesheet_link | +------------------------------------+-----------------------+ | Phalcon\\Tag::javascriptInclude | javascript_include | +------------------------------------+-----------------------+ | Phalcon\\Tag::image | image | +------------------------------------+-----------------------+ | Phalcon\\Tag::friendlyTitle | friendly_title | +------------------------------------+-----------------------+ 视图集æˆ(View Integration) ------------------------------- Volt 模æ¿é›†æˆäº† :doc:`Phalcon\\Mvc\\View <views>`, ä½ çš„æ¨¡æ¿å±‚æ¬¡ç»“æž„å’Œé»˜è®¤çš„å±‚æ¬¡ç»“æž„ä¸€æ ·ï¼Œä½ å¯ä»¥è¿™æ ·ä½¿ç”¨ partials : .. code-block:: html+jinja {{ content() }} {{ partial("partials/footer.volt") }} 模æ¿ç»§æ‰¿(Template Inheritance) ------------------------------------------- 模æ¿ç»§æ‰¿ï¼šä½ å¯ä»¥åˆ›å»ºä¸€ä¸ªåŸºç¡€æ¨¡æ¿ï¼Œå…¶ä»–模æ¿ç»§æ‰¿è‡ªè¿™ä¸ªåŸºç¡€æ¨¡æ¿ï¼Œå¯æé«˜æ¨¡æ¿æ–‡ä»¶çš„å¤ç”¨æ€§ã€‚基础模æ¿ä½¿ç”¨ *blocks* 定义一个å—,这个å—å¯ä»¥æ˜¯å¯ä»¥è¢«å模æ¿è¦†ç›–的。现在让我们å‡è®¾ï¼Œæˆ‘们有以下的基础模æ¿ï¼š .. code-block:: html+jinja {# templates/base.volt #} <!DOCTYPE html> <html> <head> {% block head %} <link rel="stylesheet" href="style.css" /> {% endblock %} <title>{% block title %}{% endblock %} - My Webpage</title> </head> <body> <div id="content">{% block content %}{% endblock %}</div> <div id="footer"> {% block footer %}© Copyright 2012, All rights reserved.{% endblock %} </div> </body> </html> 其他的模æ¿å¯ä»¥ç»§æ‰¿è‡ªè¿™ä¸ªåŸºç¡€æ¨¡æ¿ï¼ŒåŒæ—¶æ›¿æ¢æŽ‰åŸºç¡€æ¨¡æ¿ä¸çš„ block: .. code-block:: jinja {% extends "templates/base.volt" %} {% block title %}Index{% endblock %} {% block head %}<style type="text/css">.important { color: #336699; }</style>{% endblock %} {% block content %} <h1>Index</h1> <p class="important">Welcome on my awesome homepage.</p> {% endblock %} å¹¶éžæ‰€æœ‰çš„ block 都需è¦åœ¨å模æ¿ä¸è¿›è¡Œæ›¿æ¢(æ„æ€æ˜¯ï¼Œä½ å¯ä»¥æ›¿æ¢éœ€è¦çš„那一部分)。上é¢çš„示例最终输出结果如下: .. code-block:: html <!DOCTYPE html> <html> <head> <style type="text/css">.important { color: #336699; }</style> <title>Index - My Webpage</title> </head> <body> <div id="content"> <h1>Index</h1> <p class="important">Welcome on my awesome homepage.</p> </div> <div id="footer"> © Copyright 2012, All rights reserved. </div> </body> </html> 作为一个片æ–,"extends" åŽè·Ÿçš„è·¯å¾„æ˜¯ä¸€ä¸ªç›¸å¯¹äºŽè§†å›¾å˜æ”¾ç›®å½•的相对路径(å³ app/views). .. highlights:: 默认情况下,出于对性能的考虑,Voltåªæ£€æŸ¥åæ¨¡æ¿æ˜¯å¦æœ‰ä¿®æ”¹ã€‚å› ä¸ºå»ºè®®åœ¨å¼€å‘阶段åˆå§‹æ—¶ä½¿ç”¨ 'compileAlways' => trueã€‚è¿™æ ·çš„è¯ï¼Œæ¨¡æ¿å§‹ç»ˆæ£€æŸ¥çˆ¶æ¨¡æ¿æ˜¯å¦æœ‰ä¿®æ”¹ã€‚ Setting up the Volt Engine -------------------------- Volt是å¯ä»¥é€šè¿‡é…置改å˜é»˜è®¤çš„行为的,下é¢çš„例å说明如何åšåˆ°è¿™ä¸€ç‚¹ï¼š .. code-block:: php <?php //Register Volt as a service $di->set('voltService', function($view, $di) { $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di); $volt->setOptions(array( "compiledPath" => "../app/compiled-templates/", "compiledExtension" => ".compiled" )); return $volt; }); //Register Volt as template engine $di->set('view', function() { $view = new \Phalcon\Mvc\View(); $view->setViewsDir('../app/views/'); $view->registerEngines(array( ".volt" => 'voltService' )); return $view; }); å¦‚æžœä½ ä¸é‡ç”¨ Voltï¼Œä½ å¯ä»¥ä¸æŠŠå®ƒä½œä¸ºä¸€ä¸ªæœåŠ¡ï¼Œè€Œæ˜¯åœ¨æ³¨å†Œ view æœåŠ¡çš„æ—¶å€™ï¼Œç”¨åŒ¿åå‡½æ•°çš„æ–¹å¼æ³¨å†ŒVolt模æ¿å¼•擎: .. code-block:: php <?php //Register Volt as template engine with an anonymous function $di->set('view', function() { $view = new \Phalcon\Mvc\View(); $view->setViewsDir('../app/views/'); $view->registerEngines(array( ".volt" => function($view, $di) { $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di); //set some options here return $volt; } )); return $view; }); Volt é…置选项: +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ | Option | Description | Default | +===================+================================================================================================================================+=========+ | compiledPath | A writable path where the compiled PHP templates will be placed | ./ | +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ | compiledExtension | An additional extension appended to the compiled PHP file | .php | +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ | compiledSeparator | Volt replaces the directory separators / and \\ by this separator in order to create a single file in the compiled directory | %% | +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ | stat | Whether Phalcon must check if exists differences between the template file and its compiled path | true | +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ | compileAlways | Tell Volt if the templates must be compiled in each request or only when they change | false | +-------------------+--------------------------------------------------------------------------------------------------------------------------------+---------+ ç›¸å…³èµ„æº ------------------ * A bundle for Sublime/Textmate is available `here <https://github.com/phalcon/volt-sublime-textmate>`_ * Our website is running using Volt as template engine, check out its code on `github <https://github.com/phalcon/website>`_ .. _Twig: https://github.com/vito/chyrp/wiki/Twig-Reference .. _Jinja: http://jinja.pocoo.org/ .. _trim: http://php.net/manual/en/function.trim.php .. _striptags: http://php.net/manual/en/function.striptags.php .. _slashes: http://php.net/manual/en/function.slashes.php .. _stripslashes: http://php.net/manual/en/function.stripslashes.php .. _ucwords: http://php.net/manual/en/function.ucwords.php .. _nl2br: http://php.net/manual/en/function.nl2br.php .. _asort: http://php.net/manual/en/function.asort.php .. _JSON: http://php.net/manual/en/function.json-encode.php