|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
elmozaur Smarty Rookie
Joined: 19 Jun 2011 Posts: 6
|
Posted: Sun Jun 19, 2011 6:38 pm Post subject: Zend variable in Smarty template |
|
|
Hi.
I'm starting learning Smarty.
What I need is to display variable in template
I know that the simplest way is {$tyty}
My problem is that my variable is from Zend Framework.
Question:
How to display something like this:
<p><a href="<?php echo $this->url( array( 'controller' => 'content', 'action' => 'index', 'napis' => 'tojesttytulek', 'id' => '30', 'kat' => '20' ), "kontent", TRUE);?>">news new</a></p>
I'm trying with this:
<p><a href="{$this->url(['controller' => 'content', 'action' => 'index', 'tytul' => 'tojesttytulek', 'id' => '30', 'kat' => '20'], "kontent", TRUE)}">news new</a></p>
but it's wrong way.
As you can see first parameter in method url is array next is string and last is bool.
Is possiblle to write it in Smarty 3 format? (in tpl file)
thanks for any help. |
|
Back to top |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
Posted: Sun Jun 19, 2011 6:56 pm Post subject: |
|
|
you may want to register the object (your $this) with smarty, something like Code: | $smarty->assign('controller', $this); |
and in the template access it with Code: | {$controller->url(…)} |
|
|
Back to top |
|
elmozaur Smarty Rookie
Joined: 19 Jun 2011 Posts: 6
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|