NikolayMurha / SmartyModule

Zend Framework 2 Module for Smarty
30 stars 25 forks source link

complex smarty inclusions #1

Open xro opened 11 years ago

xro commented 11 years ago

Hi. Thanks for this module.

Have question: how do you deal with such:

{$this->headTitle('ZF2 '. $this->translate('Skeleton Application'))->setSeparator(' - ')->setAutoEscape(false)}

or

{$this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/images/favicon.ico')) ->prependStylesheet($this->basePath() . '/css/bootstrap-responsive.min.css') ->prependStylesheet($this->basePath() . '/css/style.css') ->prependStylesheet($this->basePath() . '/css/bootstrap.min.css')}

they result in error and I am not sure how to avoid it. Note I'd like to do these operations on template level. Any ideas?

jurajseffer commented 11 years ago

The first one works OK. I had to remove translate() though as I don't load it.

The second: you can make individual calls to headLink() on separate lines, either try wrapping it with {capture} or just {$tmp=$this->headLink()...} With regards to the array, I think you can use the following method: {$menu = ['item1','item2','item3' => ['item3-1','item3-2','item3-3' => ['item3-3-1','item3-3-2']],'item4']} see http://www.smarty.net/v3_overview