On Wed, Apr 2, 2008 at 12:28 PM, csnyder <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 2, 2008 at 9:53 AM, David Mintz <[EMAIL PROTECTED]> wrote:
>
> > Before I start trying to un-break it please tell me if this logic is
> sound:
> > when they do an ajax request, store the query params in the session.
> > Whenever they GET the page itself, look first for these session vars and
> use
> > them if they exist, else use the defaults.
> >
>
> That's probably the easiest way to do it, if you're already using
> sessions.
>
> You could also use js to write the current params directly to cookie.
This works. It's kind of baroque, if not to say warped, but within a
controller method in a Zend Framework app, we go:
$session = new Zend_Session_Namespace('Schedule');
$params = (object) $this->getRequest()->getParams();
$defaultParams = array(
'language'=>'all',
'date' => date('Y-m-d')
);
foreach ($defaultParams as $name => $default) {
if (!empty($params->$name)) {
${$name} = $session->$name = $params->$name ;
} elseif ($session->$name) {
${$name} = $session->$name;
} else {
${$name} = $default;
}
}
// then $date and $language get passed to data-fetching methods in my
model
--
David Mintz
http://davidmintz.org/
The subtle source is clear and bright
The tributary streams flow through the darkness
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php