{"id":253815,"date":"2015-03-26T09:56:02","date_gmt":"2015-03-26T05:56:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=253815"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=253815","title":{"rendered":"\u0412\u043a\u0443\u0441\u043d\u044f\u0448\u043a\u0438 \u043e\u0442 \u043d\u043e\u0432\u043e\u0439 PHPixie Template"},"content":{"rendered":"<p>     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/87b\/374\/693\/87b3746932ca51efd00026e497350490.png\" alt=\"image\" align=\"right\"\/><br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0442 <a href=\"http:\/\/phpixie.com\">PHPixie<\/a>, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044d\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440. \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u043a \u044f\u0437\u044b\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c PHP, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u041e\u0431 \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e \u0441\u0430\u043c\u043e\u043c \u0432\u043a\u0443\u0441\u043d\u043e\u043c: \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432. PHPixie Template \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0432 PHP, \u0430 \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u0438\u0445 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0442\u0434. \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0437\u0430 \u0432\u0430\u0441. \u0422\u0430\u043a\u0436\u0435, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>  \u0418\u0442\u0430\u043a \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c Template \u0441 HAML. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/packagist.org\/packages\/mthaml\/mthaml\">mthaml\/mthaml<\/a><br \/>  <a name=\"habracut\"><\/a><\/p>\n<pre><code class=\"javascript\">\/\/composer.json {     &quot;require&quot;: {         &quot;phpixie\/template&quot;: &quot;3.*@dev&quot;,         &quot;phpixie\/slice&quot;: &quot;3.*@dev&quot;,         &quot;mthaml\/mthaml&quot;: &quot;1.7.0&quot;     } } <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0440\u0430\u043f\u043f\u0435\u0440:<\/p>\n<pre><code class=\"php\">&lt;?php  class HamlFormat implements \\PHPixie\\Template\\Formats\\Format {     protected $mtHaml;          public function __construct()     {         $this-&gt;mtHaml = new \\MtHaml\\Environment('php');     }          \/\/\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u0444\u043e\u0440\u043c\u0430\u0442     public function handledExtensions()     {         return array('haml');     }          \/\/\u0421\u0430\u043c\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f     public function compile($file)     {         $contents = file_get_contents($file);         return $this-&gt;mtHaml-&gt;compileString($contents, $file);     } } <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432 \u0441\u0430\u043c Template:<\/p>\n<pre><code class=\"php\">\/\/\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0435\u0449\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \/\/\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 $slice = new \\PHPixie\\Slice();  $config = $slice-&gt;arrayData(array(     'resolver' =&gt; array(         'locator' =&gt; array(             \/\/\u041f\u0430\u043f\u043a\u0430 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438             'directory'        =&gt; __DIR__.'\/templates\/',             'defaultExtension' =&gt; 'haml',         )     ),     'compiler' =&gt; array(         \/\/\u0413\u0434\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b         'cacheDirectory' =&gt; &gt; __DIR__.'\/cache\/',     ) ));  $template = new \\PHPixie\\Template($slice, $config, array(), array(     new HamlCompiler() )); <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 <i>haml<\/i> \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0438\u043b\u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u044f\u0437\u044b\u043a, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f.<\/p>\n<p>  <b>\u041d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/b><br \/>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u044b\u043b <i>include<\/i>. \u0422\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0438\u0434\u0442\u0438 \u0441\u0432\u0435\u0440\u0445\u0443 \u0432\u043d\u0438\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u043e \u043f\u0443\u0442\u0438. \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c. \u0410 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u0447\u0442\u043e \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c:<\/p>\n<pre><code class=\"php\">\/\/\u0444\u0430\u0439\u043b layout.php &lt;html&gt;     &lt;title&gt;         &lt;?php $this-&gt;block('title'); ?&gt;     &lt;\/title&gt;     &lt;body&gt;         &lt;?php $this-&gt;childContent(); ?&gt;              &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<pre><code class=\"php\">\/\/\u0444\u0430\u0439\u043b fairy.php &lt;?php $this-&gt;layout('layout'); ?&gt; &lt;?php $this-&gt;startBlock('title'); ?&gt; Fairy page &lt;?php $this-&gt;endBlock(); ?&gt;  &lt;h2&gt;Hello &lt;?php $_($name); ?&gt;&lt;\/h2&gt; <\/code><\/pre>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d <i>fairy.php<\/i> \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 <i>layout.php<\/i> \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438 \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435. \u0422\u0435\u043c \u043a\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Twig \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>include<\/i> \u044d\u0442\u043e \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e:  <\/p>\n<pre><code class=\"php\">include $this-&gt;resolve('fairy'); <\/code><\/pre>\n<p>  <b>\u041f\u043e\u0438\u0441\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/b><br \/>  \u0428\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0447\u0430\u0441\u0442\u043e \u0438\u043c\u0435\u044e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0433\u0434\u0435 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439. \u0427\u0430\u0441\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0442\u0435\u043c \u0431\u0430\u0437\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445. \u0412\u043c\u0435\u0441\u0442\u043e \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 PHPixie Template \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0430\u043c\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 3-\u0445 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u043e\u0432:<\/p>\n<ul>\n<li>Driectory \u2014 \u0438\u0449\u0435\u0442 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430, \u0441\u0430\u043c\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439<\/li>\n<li>Group \u2014 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u0442 \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b, \u043f\u043e\u0438\u0441\u043a \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0435 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/li>\n<li>Prefix \u2014 \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043a \u0438\u043c\u0435\u043d\u0438<\/li>\n<\/ul>\n<p>  \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433:  <\/p>\n<pre><code class=\"php\">&lt;?php  $config = $slice-&gt;arrayData([     'resolver' =&gt; [         'locator' =&gt; [             'type'     =&gt; 'prefix',             'locators' =&gt; [                                  'Site' =&gt; [                     'directory'  =&gt; __DIR__.'\/site\/',                 ],                                      'Theme' =&gt; [                     'type'       =&gt; 'group',                     'locators'   =&gt; [                         [                             'directory' =&gt; __DIR__.'\/templates\/',                         ],                                                  [                             'directory' =&gt; __DIR__.'\/fallback\/',                         ],                     ]                  ]             ]         ]     ] ]); <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d <i>Site::layout<\/i> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 <i>site\/<\/i>, \u0430 <i>Theme::home<\/i> \u0432 \u043f\u0430\u043f\u043a\u0430\u0445 <i>templates\/<\/i> \u0438 <i>fallbacks\/<\/i>.<\/p>\n<p>  <b>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/b><br \/>  \u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 HTML, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"php\">class HTML implements \\PHPixie\\Template\\Extensions\\Extension {     public function name()     {         return 'html';     }          \/\/\u041c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \\\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445     public function methods()     {         return array('escape', 'output');     }          \/\/\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     \/\/\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c $_($name) \u0432\u043c\u0435\u0441\u0442\u043e $this-&gt;output($name)     public function aliases()     {         return array(             '_' =&gt; 'output'         );     }          \/\/\u0421\u0430\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u044b     public function escape($string)     {         return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');     }          public function output($string)     {         echo $this-&gt;escape($string);     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0438\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.<\/p>\n<p>  <b>\u0414\u0435\u043c\u043e<\/b><br \/>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Template \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e:  <\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/phpixie\/template cd template\/examples   #\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0449\u0435 \u043d\u0435\u0442 \u041a\u043e\u043c\u043f\u043e\u0437\u0435\u0440\u0430 curl -sS https:\/\/getcomposer.org\/installer | php   php composer.phar install php quickstart.php <\/code><\/pre>\n<p>  \u0418 \u043a\u0441\u0442\u0430\u0442\u0438 \u043a\u0430\u043a \u0438 \u0443 \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u043e\u0442 PHPixie \u0432\u0430\u0441 \u0436\u0434\u0435\u0442 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u043a\u043e\u0434\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e\u0434 \u043b\u044e\u0431\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 PHP \u0441\u0442\u0430\u0440\u0448\u0435 5.3 ( \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u043e\u0432\u0443\u044e 7 \u0438 HHVM )      \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/253973\/\"> http:\/\/habrahabr.ru\/post\/253973\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/87b\/374\/693\/87b3746932ca51efd00026e497350490.png\" alt=\"image\" align=\"right\"\/><br \/>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0441\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0442 <a href=\"http:\/\/phpixie.com\">PHPixie<\/a>, \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044d\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440. \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u043a \u044f\u0437\u044b\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u043c PHP, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u041e\u0431 \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u0437\u0436\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e \u0441\u0430\u043c\u043e\u043c \u0432\u043a\u0443\u0441\u043d\u043e\u043c: \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432. PHPixie Template \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0438\u0448\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0432 PHP, \u0430 \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u0438\u0445 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0442\u0434. \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0437\u0430 \u0432\u0430\u0441. \u0422\u0430\u043a\u0436\u0435, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>  \u0418\u0442\u0430\u043a \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c Template \u0441 HAML. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/packagist.org\/packages\/mthaml\/mthaml\">mthaml\/mthaml<\/a>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-253815","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/253815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=253815"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/253815\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=253815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=253815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=253815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}