Warning: Constant ABSPATH already defined, this will be an error in PHP 9 in /home/killerph/public_html/wp-config.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /home/killerph/public_html/wp-config.php:19) in /home/killerph/public_html/wp-includes/feed-rss2-comments.php on line 8
Comments on: Zend Framework: Using View Helpers to Build Rich, Scalable, Controls https://www.killerphp.com/articles/zend-framework-view-helpers/ Thu, 09 Dec 2021 20:55:11 +0000 hourly 1 https://wordpress.org/?v=6.4.14 By: Drevak https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-425 Sun, 25 Jan 2009 14:36:04 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-425 You dont need to instance a new Zend_view object, just define a setView method in your helper, like this:

public $view;

public function setView(Zend_View_Interface $view)
{
$this->view = $view;
}

]]>
By: Elijah Insua https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-424 Mon, 24 Mar 2008 04:07:53 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-424 I have used this method with various php frameworks many times. I actually prefer breaking up my templates and following a half ‘naked objects’ approach where the actual item that you are working with contains the templates and business logic.

]]>
By: Zend Framework: Using View Helpers to Build Rich, Scalable, Controls https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-423 Sat, 22 Mar 2008 19:52:35 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-423 […] More: continued here […]

]]>
By: Jon Lebensold https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-422 Thu, 28 Feb 2008 07:23:00 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-422 @Lee: Thanks for mentioning this! I was looking for a way to call View Helpers without creating a whole new Zend_View or having to create custom classes that would be called from a view helper only for some instances.

]]>
By: Lee https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-421 Tue, 12 Feb 2008 02:03:18 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-421 This is a great post! I am in need of partials in my project and this post set me on the right path to figuring out how to do it. I’m not using AJAX but this idea is very useful. The only thing I am doing differently is that instead of instantiating a new Zend_View and setting the basepath in my View Helper I am retrieving the View Helper that is already initialized in my View Renderer like this:

$view = Zend_Controller_Action_HelperBroker::getExistingHelper(‘viewRenderer’)->view;

Then you can set variables for your view scripts and render them like this:

$view->someVar = “someValue”;
$out = $view->render(“path/to/viewScript.phtml”);
return $out;

This saves you from having to create a brand new Zend_View and trying to figure out how to set the basepath in a portable way. You do need to be mindful of the fact that you aren’t creating a new namespace for your partial so be ware of variable name clashes. Since you are reusing the same view your controller is using, anything you set using $this->view->whatever will also be available in your partial view script as $this->whatever.

]]>
By: Jon Lebensold » Blog Archive » Article on Zend View Helpers https://www.killerphp.com/articles/zend-framework-view-helpers/#comment-420 Fri, 01 Feb 2008 08:59:25 +0000 http://www.killerphp.com/articles/zend-framework-view-helpers/#comment-420 […] Another article has been posted on KillerPHP. This one is about Zend View_Helpers. I’ve been struggling with a good Zend Framework architecture that provides a development roadmap where controller logic can be easily refactored into AJAX controls. At work I’ve been researching web services for AJAX integration on the ASP.NET tip of things due to the lack of user-control support for AJAX.NET controls. I’m also not very impressed with the AJAX.NET Extenders since they seem to mix data that would be gathered from a web service and its presentation on the client. […]

]]>