MtHaml
MtHaml copied to clipboard
Using namespaces [syntax error, unexpected 'use' (T_USE)]
https://github.com/mervick/yii2-mthaml/issues/1
May be necessary to parse all used namespaces and paste them before the function definition in the cache file. Something like this Input:
- use yii\helpers\Url
%a{:href => Url::toRoute(['shopping/ping', 'id' => (string)$item->productId, 'category' => (string)$item->primaryCategory->categoryId])} test
Output (cache file):
<?php
use yii\helpers\Url;
function __MtHamlTemplate_3d0018f2469c15708ab379082527f7c90b6b28b9be2e47a1e7d794562143a903($__variables)
{
extract($__variables);
?><a <?php echo MtHaml\Runtime::renderAttributes(array(array('href', (Url::toRoute(['shopping/ping', 'id' => (string)$item->productId, 'category' => (string)$item->primaryCategory->categoryId])))), 'html5', 'UTF-8'); ?>>test</a>
}