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

Variable in {include} #26

Closed
Budry opened this issue Jul 4, 2014 · 6 comments
Closed

Variable in {include} #26

Budry opened this issue Jul 4, 2014 · 6 comments

Comments

@Budry
Copy link

Budry commented Jul 4, 2014

Hi,
I'm not sure if it is bug, but I have two same codes but each is compiled differently

{include $themeDir . '/components/confirmDelete.latte'}
{include $themeDir.'/components/confirmDelete.latte'}

First {include} returns error syntax error, unexpected '.', expecting ')'
Compilated code:

<?php $_b->templates['7691012173']->renderChildTemplate($themeDir, array(. '/components/confirmDelete.latte') + $template->getParameters()) ;

Second include works OK
The only difference is in spaces before and after . (dot)

@Majkl578
Copy link
Contributor

Majkl578 commented Jul 4, 2014

That is not a bug, because space is an argument delimiter. But the error is really misleading.

@mishak87
Copy link
Contributor

mishak87 commented Jul 4, 2014

It would be better to promote/use "$variable/path" syntax rather then concatenation in templates. It is simpler, clearer and without such WTF moments.

{include "$themeDir/components/confirmDelete.latte"}

OT rixxi/template-locator might be useful for organizing templates and themes without variables like $themeDir in templates.

@dg
Copy link
Member

dg commented Jul 7, 2014

Space is really argument delimiter, but argument cannot begins with ., so $themeDir . '...' should be supported too.

castamir pushed a commit to castamir/latte that referenced this issue Nov 7, 2014
castamir pushed a commit to castamir/latte that referenced this issue Nov 8, 2014
@castamir
Copy link

castamir commented Nov 8, 2014

This commit should fix concatenation with spaces in all macros (not only in include macro).

@castamir
Copy link

@dg what do you think about it?

castamir pushed a commit to castamir/latte that referenced this issue Nov 15, 2014
@castamir
Copy link

Concatenation refactored

castamir pushed a commit to castamir/latte that referenced this issue Nov 15, 2014
@dg dg closed this as completed in 71c5175 Dec 21, 2014
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

5 participants