开发者

Best Practices/How-To for Changing Zend_Session Values with JavaScript

开发者 https://www.devze.com 2023-01-09 05:48 出处:网络
I am migrating an old project to Zend Framework. I have a drop down list that changes filter context. In the old project the onClick event of the <select>开发者_运维百科; list ran a function that

I am migrating an old project to Zend Framework. I have a drop down list that changes filter context. In the old project the onClick event of the <select>开发者_运维百科; list ran a function that made a jQuery ajax call to a php script that essentially updated the $_SESSION variable and then the JavaScript reloaded the page when the response came back. I have a couple of questions:

  1. Is this an okay practice?
  2. Should I send the request to a Controller instead of a servlet? One of the issues with this is that the drop down list is built in a view helper and is available across all Controllers, but I understand I could put the necessary code in and have them all inherit it.
  3. If I DO go the stand-alone servlet type route, where do I put the php file in the hierarchy? I'm assuming the public folder- so pardon me if it is a dumb question.
  4. I'm not familiar with Zend_Session, are there any gotchas to watch out for?

--EDIT--

After some initial code testing I have run into an issue with my servlet php file (let's call it registrar.php) is not able to get the Zend_Session_Namespace from the Zend_Registry when it is standalone (I'm not sure if I'm not doing it right, but since it's not being sent through index.php it makes sense to me that it can't access the registry). Instead of registrar.php I'm going to create a RegistrarController


I have created a RegistrarController, disabled the standard layout and view and put my logic in there

0

精彩评论

暂无评论...
验证码 换一张
取 消