|
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 |
ember Smarty n00b
Joined: 04 Jan 2009 Posts: 2
|
Posted: Sun Jan 04, 2009 6:22 pm Post subject: Metoda zwracajaca obiekt |
|
|
Witam.
Przekazuje do smarty obiekt, ktorego jedna z metod zwraca inny obiekt. Nastepnie probuje uzyskac dane z metody zwracanej przez pobrany obiekt, lecz niestety nie wychodzi.
Probowalem tak:
Quote: | {$Article->ShowCategory()->ShowName()} |
ale wyskakuje blad:
Quote: | syntax error: unrecognized tag: $Article->ShowCategory()->ShowName() (Smarty_Compiler.class.php, line 446) |
Probowalem tez tak:
Quote: | {$Category = Article->ShowCategory()}{$Category->ShowName()} |
ale wyskakuje blad:
Quote: | Call to a member function ShowName() on a non-object |
W drugim sposobie zadne dane nie sa przypisywane zmiennej.
W PHP wystarczy Quote: | $Article->ShowCategory()->ShowName() | lecz niestety to nei dziala w Smarty.
Jakeis pomysly? czy musze przekazywac te dane do smarty osobno? |
|
Back to top |
|
ember Smarty n00b
Joined: 04 Jan 2009 Posts: 2
|
Posted: Mon Jan 05, 2009 4:25 pm Post subject: |
|
|
Problem rozwiazany.
Wiecej o problemie: phpinsider (dot) com/smarty-forum/viewtopic.php?t=11335
Wczesniej nie zauwazylem |
|
Back to top |
|
fornve Smarty Rookie
Joined: 25 Apr 2008 Posts: 29 Location: Sheffield, UK
|
Posted: Tue Mar 10, 2009 8:34 am Post subject: |
|
|
Code: |
{assign var=category value=$Article->ShowCategory()}
{$category->ShowName()}
|
|
|
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
|