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

Hey. #4

Closed
xro opened this issue Jan 16, 2013 · 5 comments
Closed

Hey. #4

xro opened this issue Jan 16, 2013 · 5 comments

Comments

@xro
Copy link

xro commented Jan 16, 2013

First of all thanks for creating this stuff. As integrating smarty into ZF2 for framework newbies is nightmare.

Second, have installed your module but in templates I get displayed
{$this->doctype()}
instead of having doctype executed and outputted.
Any possible reasons?
thanks

@maxnuf
Copy link
Owner

maxnuf commented Jan 16, 2013

It seems Smarty isn't loaded at all.
Make sure that you added 'MaxnufSmarty' to 'modules' in the config/application.config.php file.

@xro
Copy link
Author

xro commented Jan 17, 2013

Thanks for reply. Managed to have operational maxnufsmarty now (fixed my config entries).
..but the other issue came out.

say this works perfectly: {$this->doctype()}
but having something like:
{$this->headScript()->prependFile($this->basePath() . '/js/html5.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->prependFile($this->basePath() . '/js/bootstrap.min.js')
->prependFile($this->basePath() . '/js/jquery.min.js')}
will throw SmartyCompilerException with Syntax Error message. Its due to concatenation struff (me thinks).
So wanted just to do
{php}
echo $this->headScript()->prependFile($this->basePath() . '/js/html5.js', 'text/javascript', array('conditional' => 'lt IE 9',))
->prependFile($this->basePath() . '/js/bootstrap.min.js')
->prependFile($this->basePath() . '/js/jquery.min.js');
{/php}

but seems php tag is faulty with your implementation getting error
'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for php

Tried to resolve it myself but no fun.
This issue is probably more interesting for you:)

@maxnuf
Copy link
Owner

maxnuf commented Jan 18, 2013

well can't and shouldn't use {php} tags, they are deprecated. See http://www.smarty.net/docs/en/language.function.php.tpl

I'm not sure why concatenation doesn't work. I'll look into it.
In the meantime you could maybe work around this issue by assigning it to a variable first using {assign}?

@Spiderschwein
Copy link

Yeah concatenation with the .-operator like php won't work, because the . is special in smarty for array access.

I'd the same problem but i solved it with the cat modifier from smarty.

so instead of
prependFile($this->basePath() . '/js/jquery.min.js')}
simply write
prependFile($this->basePath()|cat:'/js/jquery.min.js')}

@maxnuf
Copy link
Owner

maxnuf commented Feb 7, 2013

the cat modifier will work.
note that you'll also get trouble using

array('foo' => 'bar')

simply use '[ ]' instead

['foo' => 'bar']

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

3 participants