0
votes

In my self written php framework i have a method to display a simple message:

$page->displayMessage('Title','Body','error','layout.php');

This loads a view and layout and displays the message in it. I use it for messages for which i dont want to make a new view for.

Now i'm missing this functionality in Zend and want to implement it again but at first i want to ask you guys if there is already something like this in the Zend Framework and i didn't noticed it?

2

2 Answers

1
votes

Another common method is to throw an exception (assuming you are letting the user know about an error), and using the error handler plugin to catch it, and spit out a friendly version of the message to the user.

0
votes
<?php echo $this->partial('partial.phtml', array(
    'body' => 'Team Framework',
    'title' => 'view partials',
    'error'=>'my error')); ?>

and inside partial.phtml we have following content

<title><?php echo $this->title ?></title>
<body><?php echo $this->body ?>   <?php echo $this->error ?></body>

Partial is a view helper . Here $this is an instance of Zend_View . If you want to call this code in controller then use $this->view->partial(); instead