2009年1月29日星期四

Re: [fw-mvc] Best way to access global view variable from partialLoop?

Just wondering, for those with singletonphobia (that's the opposite of singletonitis), what's a good way to not have to rely on the Zend_Auth singleton (assume you can wrap Zend_Auth into another class)

On Thu, Jan 29, 2009 at 2:04 PM, Hector Virgen <djvirgen@gmail.com> wrote:
If you're using Zend_Auth, you don't need to access your controller:

<?php

$loggedin = Zend_Auth::getInstance()->hasIdentity();

if (true === $loggedin) {
    // user is logged in
}

?>

If you're not using Zend_Auth, you may want to store your login info somewhere accessible, like the registry or session, which should be accessible from your view helper. Storing it in the controller locks the user into that controller.

-Hector



On Thu, Jan 29, 2009 at 10:51 AM, GJ Bogaerts <gj@zigg.nl> wrote:

Hi Avi

thanks, I thought of that. But that would need to be a view helper that
directly accesses the controller, wouldn't it? Because that's where the
login status is kept.


Avi Block wrote:
>
> use a view helper
>
>
>
--
View this message in context: http://www.nabble.com/Best-way-to-access-global-view-variable-from-partialLoop--tp21722277p21733248.html
Sent from the Zend MVC mailing list archive at Nabble.com.



没有评论: