Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using namespaces [syntax error, unexpected 'use' (T_USE)] #79

Open
mervick opened this issue Mar 24, 2015 · 0 comments
Open

Using namespaces [syntax error, unexpected 'use' (T_USE)] #79

mervick opened this issue Mar 24, 2015 · 0 comments

Comments

@mervick
Copy link
Contributor

mervick commented Mar 24, 2015

mervick/yii2-mthaml#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>
}
mervick added a commit to mervick/MtHaml that referenced this issue Mar 26, 2015
mervick added a commit to mervick/MtHaml that referenced this issue Mar 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant