Re: [fw-general] Smarty Poll Question

2008-09-24 Thread Michael Patrick

Garrison Locke wrote:

I know this usually starts a big war, but I was just curious about how
many people out there are using Smarty and to what extent you're using it?
 If you're not using it, why did you decide to not use it?  If you are,
why?  Also, if you're using it, how big or small are the projects?  Just
personal things or like giant things with tens of thousands of users.


We use Smarty on the main project where I work.  Back when the project 
started Zend_View was primitive and we thought Smarty hiding the PHP 
might be more friendly in the future to the army of frontend UI 
specialists we were going to be hiring.


Fast-forward a couple of years... no horde of UI people and that project 
still uses Smarty but only because I don't have the time to rip it out 
and replace it. Generally it annoys me every time I have to open a TPL 
file.


All new development is straight Zend_View.

Michael


Re: [fw-general] Undefined controller

2007-02-16 Thread Michael Patrick

Jakub Podhorský wrote:

But theres bug in version 0.7 as I see where isDispatchable() always returns
true(need to upgrade to some snapshot :) )


Oh, yeah I probably should have mentioned that I've been tracking Zend's 
HEAD for a while.  I work on this project off and on so I'm not sure 
whether or not it even worked with 0.7.0.


Here is the function that I had prior to late January ( the start of 
some post-0.7.0 MVC changes ).  Maybe it'll help you ( see above 
disclaimer of not being sure codebase worked with 070 )


public function preDispatch(Zend_Controller_Request_Abstract $request) {
$disp = Zend_Controller_Front::getInstance()->getDispatcher();

if ( !$disp->isDispatchable($request) ) {
$request->setParam('module', null);
$request->setControllerName('error');
$request->setActionName('error404');
}
}


Re: [fw-general] Undefined controller

2007-02-16 Thread Michael Patrick

Jakub Podhorský wrote:

This looks cool for me but I have one question. This is part of your plugin
isnt it? And that plugin is child of Zend_Controller_Plugin_Abstract object?


Yes, that is correct.  It looks pretty much like what Dmitry posted in 
his reply.




Re: [fw-general] Undefined controller

2007-02-16 Thread Michael Patrick

Jakub Podhorský wrote:

I want to check if this controller exist and if it doesnt I want to redirect
it on some NotFoundController or any default or by myself defined
controller.


I do this using the preDispatch hook of a front controller plugin.

public function preDispatch(Zend_Controller_Request_Abstract $request) {
$disp = Zend_Controller_Front::getInstance()->getDispatcher();  
 

if ( !$disp->isDispatchable($request) ) {
$request->setModuleName('default');
$request->setControllerName('error');
$request->setActionName('error404');
}
}

if the thing doesn't exist (  /registerxxx   instead of /register  for 
example ) then they get bounced to a 404 page.  It has worked so far for me.


Re: [fw-general] ZF 0.6.0 don't show error messages

2007-01-08 Thread Michael Patrick

Jacques Marques wrote:

Hello,

In ZF 0.2.0 when an exception was generated it display this in html code,
but in ZF 0.6.0, it don't display anything its just stop the html generator.
How can fix this?


http://framework.zend.com/wiki/display/ZFDOCDEV/4.+Zend_Controller

You need to use the renderExceptions method.  The code at the bottom of 
that documentation page gives a couple of examples.


renderException is in the archive for the list somewhere, though I 
cannot find it right now.


Re: [fw-general] revision 1863 controller front

2006-11-25 Thread Michael Patrick

Michael Depetrillo wrote:

I have revision 1863 and the __construct() method of Zend_Controller_Front
is private causing php 5.1.6 to throw a fatal error.


Looks like in 1646 the incubator Front Controller went back to singleton.

* Reinstated getInstance(), based on feedback from:
  * 
http://drone-alliance.org/wordpress/2006/11/11/discovering-the-zend-framework-020-preview/

  * many questions on-list
  * Front controllers should never have more than one instance
* Added resetInstance() method to front controller, which allows setting the
  object to a known clean state -- allowing tests to run normally.


Re: [fw-general] Best place to authenticate a user?

2006-10-02 Thread Michael Patrick

Michael Sheakoski wrote:
Of course this is only one way to do it.  I could do the checking in 
index.php, or in a FrontController plugin too, etc...  My main thing is 
to try and minimize the amount of code repeated.  In my current method I 
would have to duplicate the same code in the preRun() method of every 
ActionController.


My application has only a very few ( 5, I think ) actions that someone 
who is not logged in can access so I did it as a FrontController plugin. 
 In the preDispatch method I have a list of the 5 places anonymous 
people can go.


1) Is this action object ( controller/action pair ) trying to get to one 
of the 5?  If so, return it and on they go.

2) Ok, didn't return there so lets check if they are logged in.
3) If so, return the action object so they can go on their way.
4) If not, return new Zend_Controller_Dispatcher_Token to send them to 
the must be logged in error page and beyond for login.


Michael


Re: [fw-general] Best place to authenticate a user?

2006-09-30 Thread Michael Patrick

Michael Sheakoski wrote:
Of course this is only one way to do it.  I could do the checking in 
index.php, or in a FrontController plugin too, etc...  My main thing is 
to try and minimize the amount of code repeated.  In my current method I 
would have to duplicate the same code in the preRun() method of every 
ActionController.


My application has only a very few ( 5, I think ) actions that someone
who is not logged in can access so I did it as a FrontController plugin.
 In the preDispatch method I have a list of the 5 places anonymous
people can go.

1) Is this action object ( controller/action pair ) trying to get to one
of the 5?  If so, return it and on they go.
2) Ok, didn't return there so lets check if they are logged in.
3) If so, return the action object so they can go on their way.
4) If not, return new Zend_Controller_Dispatcher_Token to send them to
the must be logged in error page and beyond for login.

Michael
[ sorry for the dupe, Mods.. forgot to change my From: address ]