-- David Mintz <[EMAIL PROTECTED]> wrote
(on Tuesday, 11 September 2007, 11:04 AM -0400):
> What is the recommended way to have multiple actions share view scripts?
> Suppose, for example, that example.org/things/create and example.org/things/
> update/5436 are, respectively, for creating a new thing and editing the thing
> whose id is 5436. I'd like them both to use a thingform.phtml . I see that
> controller methods can "manually" go $this->render('thingform') and that
> works,
> or I can symlink thingform to create.phtml and not render manually... but
> what's the officially approved technique?
You've got it:
$this->render($alternateAction);
That's the appropriate way to switch view scripts.
> I have not been able to figure out how to make a view include/render another
> view, except with a plain old PHP include() or require(), which also works,
> but... Same question: what's the recommended technique for this?
In your view script, use the same render() method you use with the view
object:
<?= $this->render('foobar.phtml'); ?>
It requires the full script name (i.e., you need the script suffix), but
this has been supported since day 1.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/