oops, there was a typo, try: $sf_context->getActionStack()->getLastEntry()->getActionInstance()->getPresentationFor(...)
hmmm, that's why the new way is better! Fabien Rick wrote: > Hey Fabien, > > Just FYI, the original way that you recommend (which is what I initially > tried) does not work: > > Call to undefined method sfActionStackEntry::getPresentationFor() > > I haven't updated to the latest trunk so I haven't tested your change, but > without that change it still doesn't work the "old way". > > Ian > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > On Behalf Of Fabien POTENCIER > Sent: Wednesday, January 10, 2007 1:42 AM > To: [email protected] > Subject: [symfony-devs] Re: Is there a way to call getPresentationFor() > directly? > > > Hi Rick, > > If you want to call the getPresentationFor() method from a template, you > can use this: > > <?php echo > $sf_context->getActionStack()->getLastEntry()->getPresentationFor(...) ?> > > But most of the time, you want to call components or partials from a > template. > > If you want to call it from elsewhere: > > $content = > sfContext::getInstance()->getActionStack()->getLastEntry()->getPresentationF > or(...); > > Questions are always good. You know why? Because as I write this email, > I realize this sucks! > > The getPresentationFor() method belongs to the controller, not the action. > > So, as of r3209: > - I moved the getPresentationFor() and sendEmail() methods to the > sfController class > - I removed the old methods in the sfAction class > - I created shortcuts in the sfComponent class > > This change is fully backward compatible, but now, you can also write: > > <?php echo $sf_context->getController()->getPresentationFor(...) ?> > > or > > $content = > sfContext::getInstance()->getController()->getPresentationFor(...); > > Fabien > > Rick wrote: >> I already tried that Lukas, but I can only use getPresentation(), not >> getPresentationFor(). Any ideas? >> >> -----Original Message----- >> From: [email protected] [mailto:[EMAIL PROTECTED] >> On Behalf Of Lukas Kahwe Smith >> Sent: Monday, January 08, 2007 11:09 PM >> To: [email protected] >> Subject: [symfony-devs] Re: Is there a way to call getPresentationFor() >> directly? >> >> >> Ian wrote: >>> I need to do it from outside an action, so how would I do this from >>> sfContext? >> <?php $currentAction = >> $sf_context->getController()->getActionStack()->getLastEntry() ?> >> >> regards, >> Lukas >> >> >> >> > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
