Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Metoda zwracajaca obiekt

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish
View previous topic :: View next topic  
Author Message
ember
Smarty n00b


Joined: 04 Jan 2009
Posts: 2

PostPosted: Sun Jan 04, 2009 6:22 pm    Post subject: Metoda zwracajaca obiekt Reply with quote

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
View user's profile Send private message
ember
Smarty n00b


Joined: 04 Jan 2009
Posts: 2

PostPosted: Mon Jan 05, 2009 4:25 pm    Post subject: Reply with quote

Problem rozwiazany.
Wiecej o problemie: phpinsider (dot) com/smarty-forum/viewtopic.php?t=11335
Wczesniej nie zauwazylem Embarassed
Back to top
View user's profile Send private message
fornve
Smarty Rookie


Joined: 25 Apr 2008
Posts: 29
Location: Sheffield, UK

PostPosted: Tue Mar 10, 2009 8:34 am    Post subject: Reply with quote

Code:

{assign var=category value=$Article->ShowCategory()}
{$category->ShowName()}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Polish All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP