Skip to content

Instantly share code, notes, and snippets.

@xboston
Created September 11, 2013 15:18
Show Gist options
  • Save xboston/6525113 to your computer and use it in GitHub Desktop.
Save xboston/6525113 to your computer and use it in GitHub Desktop.
<?php
$compiler = new \Phalcon\Mvc\View\Engine\Volt\Compiler();
$compiler->addFunction('not_empty', '!empty');
echo highlight_string($compiler->compileString('
{% if not_empty(userinfo.vk) %}
<a id="vk" href="{{ userinfo.vk }}">vk</a>
{% endif %}'),true);
/**
* Результат:
<?php if (!empty($userinfo->vk)) { ?>
<a id="vk" href="<?php echo $userinfo->vk; ?>">vk</a>
<?php } ?>
*
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment