[fw-general] Use of class member variables within controllers
I'm sure I read somewhere, that we should not create member variables in the controllers. Is this right? Is there an alternative? or have I got the wrong end of the stick somehow? Now I think about it, it might have been due to coding standards and the use of the var identifier? why is this wrong? -- Dan Field [EMAIL PROTECTED] Ffôn/Tel. +44 1970 632 582 Datblygwr Systemau Systems Developer Llyfrgell Genedlaethol Cymru National Library of Wales
[fw-general] Placeholders
Hi there, I would like to work out how to use placeholders in my script templates, so then i only need to use one main template, and then for each action / controller I can set body content within a html cell or whatever. I dont like the header / body / footer concept as that doesnt work at all with designers and is obviouslly a developer concept. Let me know thanks.
Re: [fw-general] Session problem
minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards Is it not storing the cookie session for you too ? Are you able to see any data in the session file at all ? Mine is blank, ive yet to get a reply about my wierd problem. I dont think this session stuff works and ill just go back to using pear's session classes.
[fw-general] Session problem
Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11943160 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Use of class member variables within controllers
-- Dan Field [EMAIL PROTECTED] wrote (on Wednesday, 01 August 2007, 09:25 AM +0100): I'm sure I read somewhere, that we should not create member variables in the controllers. Is this right? Is there an alternative? or have I got the wrong end of the stick somehow? Now I think about it, it might have been due to coding standards and the use of the var identifier? why is this wrong? Of course you can create member variables in the controllers. It's just that in PHP 5, you should use a visibility keyword (public, private, protected) instead of 'var' when declaring them: class IndexController extends Zend_Controller_Action { /** * Model object * @var IndexModel */ public $model; } Additionally, PHP's object model lets you create new member variables on the fly, and these are automatically public: $this-foo = 'bar'; // implicitly creates 'foo' member w/public visibility -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Session problem
Hello, Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards
Re: [fw-general] Session problem
Would you please take a look at ZF-1743 and ZF-1720? Maybe the problem you are experiencing is related in some way to one or both of these: http://framework.zend.com/issues/browse/ZF-1743 http://framework.zend.com/issues/browse/ZF-1720 If it's not the same problem, please create a new issue, along with the code needed to reproduce the problem. Please also post the version of PHP you are using and on what platform (e.g., RHEL 4, Win32). Thank you! Best regards, Darby minglee wrote: Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards
Re: [fw-general] Session problem
Hi Dan, Don't give up so easily! Although I have a lot to learn about ZF, I think ZF made a big progress on OOP for PHP. Cheers for the future of ZF and PHP! Dan Rossi-5 wrote: minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards Is it not storing the cookie session for you too ? Are you able to see any data in the session file at all ? Mine is blank, ive yet to get a reply about my wierd problem. I dont think this session stuff works and ill just go back to using pear's session classes. -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11946339 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Session problem
Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11946332 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] IP Address using zend framework
Inside controller, try $this-getRequest()-getServer('REMOTE_ADDR'); Jijo wrote: hi, Can anybody tell me any function or how to get local host ip address using zend framework. Regards, Jijo Anthony -- View this message in context: http://www.nabble.com/IP-Address-using-zend-framework-tf4198498s16154.html#a11947843 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Zend_Db and Dates
Hi, Two questions, the first is what do people think is the best way to store dates in a MySQL database, for speed/efficiency and convenience? Typically I've always used timestamps, simply because PHP uses them so much, but seeing as Zend_Date uses the ISO standard date format, so it's free of the limitations of timestamps, it doesn't make much sense for me to impose the timestamp limitations on the database, an it would certainly be easier to work with when looking directly at the DB tables. Can you still easily do date comparisons (greater/less than etc) in the SQL when the fields a date/time type? My second question is does Zend_Db_Table have any built in facility for automatically setting date_created and date_modified fields in the table, and if so how do I configure this. If not, is it easy enough to add myself? I want something that's pretty much automated. Thanks! -- Jack
Re: [fw-general] IP Address using zend framework
13sio wrote: Inside controller, try $this-getRequest()-getServer('REMOTE_ADDR'); Jijo wrote: hi, Can anybody tell me any function or how to get local host ip address using zend framework. Regards, Jijo Anthony Is there a reason why not just use $_SERVER['REMOTE_ADDR'] for simple things like that , unless it also does proxy x forward checks and geoip stuff inside it ?
Re: [fw-general] IP Address using zend framework
I think it's because doing it that way keeps everything self contained. You could potentially fake an HTTP request to your site using the PHP CLI if you wanted, e.g. for testing. If you did that, and used $_SERVER['REMOTE_ADDR'] it wouldn't work, whereas the controllers request object could be parsed a fake IP address for testing purposes. Then again, I don't know how the request object works internally, so I could be wrong. Dan Rossi wrote: 13sio wrote: Is there a reason why not just use $_SERVER['REMOTE_ADDR'] for simple things like that , unless it also does proxy x forward checks and geoip stuff inside it ? -- Jack
Re: [fw-general] IP Address using zend framework
-- Dan Rossi [EMAIL PROTECTED] wrote (on Thursday, 02 August 2007, 02:00 AM +1000): 13sio wrote: Inside controller, try $this- getRequest()- getServer('REMOTE_ADDR'); Jijo wrote: Can anybody tell me any function or how to get local host ip address using zend framework. Is there a reason why not just use $_SERVER['REMOTE_ADDR'] for simple things like that , unless it also does proxy x forward checks and geoip stuff inside it ? No. It simply checks in the $_SERVER superglobal. -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] IP Address using zend framework
-- Jack Sleight [EMAIL PROTECTED] wrote (on Wednesday, 01 August 2007, 05:11 PM +0100): I think it's because doing it that way keeps everything self contained. You could potentially fake an HTTP request to your site using the PHP CLI if you wanted, e.g. for testing. If you did that, and used $_SERVER['REMOTE_ADDR'] it wouldn't work, whereas the controllers request object could be parsed a fake IP address for testing purposes. Then again, I don't know how the request object works internally, so I could be wrong. It proxies to $_SERVER. ;-) Dan Rossi wrote: 13sio wrote: Is there a reason why not just use $_SERVER['REMOTE_ADDR'] for simple things like that , unless it also does proxy x forward checks and geoip stuff inside it ? -- Matthew Weier O'Phinney PHP Developer| [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
Re: [fw-general] Session problem
I have just tested your code (in two scripts) and it seemingly works fine. $ cat test_session1.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; ? Username set. $ cat test_session2.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); ? Username is: ?= $authNamespace-user; ? I request session1 file, then request session2 file and i get back the username set in session1 file. Troubleshooting: do you have error's being suppressed by php (or are redirected to the error_log? Perhaps the default /tmp location is not writable? Are you sure you are working in an environment (valid hostname) that can set cookies on your client (browser?) These are a few of the outside factors that might affect your ability to be able to use ext/session in general. -ralph minglee wrote: Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards
[fw-general] PHP bug when calling save() on a newly created Zend_Db_Table_Row
I'm trying to create a row and save it, but I keep getting this error message: 'Cannot refresh row as parent is missing' I tracked the problem down to Zend_Db_Table_Row_Abstract, line 371: $primaryKey = $this-_getTable()-insert($this-_data); var_dump($primaryKey) shows it's null. Backtracking to insert() in Zend_Db_Table_Abstract, line 788: return $this-_db-lastInsertId(); I changed this to: $id = $this-_db-lastInsertId(); var_dump($id); return $id; This displayed '273', the next auto increment value for the database. For some reason, the value is correctly coming back from the Zend_Db_Adapter, but something is breaking the return value from Zend_Db_Table_Abstract::insert() to Zend_Db_Table_Row_Abstract::_doInsert(). I tested with PHP 5.2.1/Ubuntu 7.04 and PHP 5.2.3/Windows Server 2003 SP2. Has anyone else encountered this problem? Can anyone share any insight?
[fw-general] about the url view helper
Hi list, when i use the view helper of Url,i met a problem.what i want is to use the url helper to construct the right url for the right router. for example,when i use the default router,it construct the url as * /news/read/id/1* for me as i call * $this-url(array('controller'='news','action'='read','id'=1)).* but now,i want to use the url like *?controller=newsaction=readid=1*,so i remove the default routes.and error occurs when i call *$this-url(array ('controller'='news','action'='read','id'=1)).* sorry for my english. /** * case one,use default route */ $router = new Zend_Controller_Router_Rewrite(); //$router-removeDefaultRoutes(); $front = Zend_Controller_Front::getInstance(); $front-setRouter($router); $front-setControllerDirectory('./application/default/controllers'); $front-dispatch(); at this case,i use $this-url(array('controller'='news','action'='read','id'=1)) would return */news/read/id/1* /** * case two,remove default routes */ $router = new Zend_Controller_Router_Rewrite(); $router-removeDefaultRoutes(); $front = Zend_Controller_Front::getInstance(); $front-setRouter($router); $front-setControllerDirectory('./application/default/controllers'); $front-dispatch(); at this case,call $this-url() would produce error.and what i want is it to return *index.php?controller=newsaction=readid=1*
RE: [fw-general] PHP bug when calling save() on a newly created Zend_Db_Table_Row
This sounds like an issue I just fixed in ZF 1.0.1: http://framework.zend.com/issues/browse/ZF-1645 Can you tell me if you're using ZF 1.0.0 or 1.0.1? Regards, Bill Karwin -Original Message- From: Justin Hendrickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 9:59 AM To: fw-general@lists.zend.com Subject: [fw-general] PHP bug when calling save() on a newly created Zend_Db_Table_Row I'm trying to create a row and save it, but I keep getting this error message: 'Cannot refresh row as parent is missing' I tracked the problem down to Zend_Db_Table_Row_Abstract, line 371: $primaryKey = $this-_getTable()-insert($this-_data); var_dump($primaryKey) shows it's null. Backtracking to insert() in Zend_Db_Table_Abstract, line 788: return $this-_db-lastInsertId(); I changed this to: $id = $this-_db-lastInsertId(); var_dump($id); return $id; This displayed '273', the next auto increment value for the database. For some reason, the value is correctly coming back from the Zend_Db_Adapter, but something is breaking the return value from Zend_Db_Table_Abstract::insert() to Zend_Db_Table_Row_Abstract::_doInsert(). I tested with PHP 5.2.1/Ubuntu 7.04 and PHP 5.2.3/Windows Server 2003 SP2. Has anyone else encountered this problem? Can anyone share any insight?
Re: [fw-general] Placeholders
Hi Dan, A Layout solution has been on the cards for a while now, and such a solution is to be decided on in the near future. For the moment you can read up on the varying solutions offered by the Layout section of Zend_View Enhanced Proposal, and the different strategy of Zend_Layout Proposal on the proposals page: http://framework.zend.com/wiki/display/ZFPROP A lot of folk are in the same boat awaiting a final accepted approach(es) so keep in mind of this and try for something that's easy to replace as a temporary measure. Not the greatest advice admittedly, but that's the reality for now ;). Best regards, Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com - Original Message From: Dan Rossi [EMAIL PROTECTED] To: Zend Framework fw-general@lists.zend.com Sent: Wednesday, August 1, 2007 10:21:32 AM Subject: [fw-general] Placeholders Hi there, I would like to work out how to use placeholders in my script templates, so then i only need to use one main template, and then for each action / controller I can set body content within a html cell or whatever. I dont like the header / body / footer concept as that doesnt work at all with designers and is obviouslly a developer concept. Let me know thanks. Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/
RE: [fw-general] Zend_Db and Dates
Excuse me, I made a small mistake - the method signature for the update() method should have a second argument: $where. You get the idea -- it should match the method signature of the abstract Table class. Regards, Bill Karwin -Original Message- From: Bill Karwin [mailto:[EMAIL PROTECTED] public function update(array $data)
[fw-general] Using a Plugin can't get some variable assigned to the Zend_View object
:) I got a plugin named TemplatePlugin, in the dispatchLoopShutdown() method I'm getting the Zend_View object this way: // Get an instance of the view from the controller action object. $objView = Zend_Controller_Action_HelperBroker::getExistingHelper( 'viewRenderer' )-view; So before I assign something to this object, in this case a Zend_Translate object registered into the Zend_Registry: // Get the Zend_Translate object from the registry. if ( false !== ( Zend_Registry::isRegistered( 'objTranslate' ) ) ) { $objView-objTranslate = Zend_Registry::get( 'objTranslate' ); } But when I try to do access this object in a phtml file there's nothing there, I mean, this $objView-objTranslate is empty into a phtml file. Any help ? Thx This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.
RE: [fw-general] ZF Book
Hi there, I agree that books, tutorials, etc. are very much needed. At Zend we are currently looking into leading a Zend Framework book (already talking to publishers). However, I would like to encourage others who have interest to also start such efforts. There are many publishers out there, Zend Framework is an easy sell (I can help you if needed), and the more books are on the shelves the better. Books very much differ in their approaches so I don't think there'll be a one-size-fits-all book. I agree that in most cases books don't make you loads of cash but they definitely help build your image as an expert and therefore long-term can be a significant part of building a successful career. We are also working on a small sample application (a lightweight blog) to show people how to use Zend Framework to build a real app. The focus here will be on showcasing framework and not writing an application that can compete with other full-featured blogging applications. I don't have timing at this point and I believe we also need more than one sample app, so again, the more the community can contribute and help with educational materials the better. Re: API stability, our goal is to keep the API as stable as possible. Of course I can't make promises but we will try our best. I also think that in the coming months we will be focusing more on 1.1, 1.2, etc.. than on a major version. There are still many things we want to work on which are of high value but will fit into the 1.x product line. Andi From: Pádraic Brady [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 31, 2007 2:05 PM To: Kevin McArthur Cc: Zend Framework General Subject: Re: [fw-general] ZF Book Hi Shekar, Likely echoing a lot of people - books take time, and they are highly unreliable for at least the first few iterations of any software. Given the rate of development in the Zend Framework, a version late 1.x/2.0 would have to be seriously considered as a possible publication target (otherwise the risk of outdated texts is likely quite high - at least if one makes a few assumptions about publication dates, likely demand, and time-to-write). 2.0 is probably out on the horizon - depends. That said, now would be a good time to get started on the bulk of the standard unchanging elements (actually the release of 0.9 would have been ;)). We have a stable API, and ongoing changes are unlikely to prove rapid (or blatantly off the map). Also, one would lack a sponsoring publisher at this time which will only get worse over the next few months as publication houses grab up experienced writers and ZF users (or at least writers who can gain familiarity in time) - something I gather is happening already from comments elsewhere, in a few places, given the publicity of the ZF and its growing mindshare. It probably wouldn't be all that hard to round up a few interested persons however, if there was a little more certainty about the future of such a proposed book, what one would seek in an author, and how the copyright/licensed distribution would play out (assuming the immediate lack of an interested publisher). I'm sure Cristain has more ideas here - he's at least penetrated the Irish market judging from my bookshelf where he's noted at least twice ;). Not to be a discouraging note - a book definitely would have an audience. It would be interesting to hear more obviously. Regards, Pádraic Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com - Original Message From: Kevin McArthur [EMAIL PROTECTED] To: Richard D Shank [EMAIL PROTECTED]; Shekar C Reddy [EMAIL PROTECTED] Cc: Zend Framework General fw-general@lists.zend.com Sent: Tuesday, July 31, 2007 8:40:21 PM Subject: Re: [fw-general] ZF Book FYI There are actually several Zend Framework books in production. I will be featuring some framework (but by no means the focus) in my upcoming book and I am aware of other ZFW feature books in development. Remember it takes a LONG time to publish a book, and the reason there is nothing on the market right now is the framework's extremely high rate of change. No one wants to write a book that is dated by the time it hits shelves. Kevin - Original Message - From: Richard D Shank mailto:[EMAIL PROTECTED] To: Shekar C Reddy mailto:[EMAIL PROTECTED] Cc: Zend Framework General mailto:fw-general@lists.zend.com Sent: Tuesday, July 31, 2007 1:35 PM Subject: Re: [fw-general] ZF Book The
RE: [fw-general] Zend_Form_Controller is now a Helper!
I have asked Matthew from the framework team to do the same with forms as he did with MVC. He will lead forms from our side and work with all the proposal authors and the community to aggregate the ideas into one final proposal and roadmap. So all of you who have written some good proposals or have voiced various opinions, this is when all that work will finalize come to fruitition. I believe Matthew will be able to start in the coming days and then the real fun will begin :) Andi From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 2:00 AM To: Zend Framework General Subject: Re: [fw-general] Zend_Form_Controller is now a Helper! Zend_Form has been discussed a lot the past few days on #zftalk. I also started working on an implementation. For more details see a link on my comment at the Zend_Form proposal. The code will change a lot in the comming days though. I'll have a look at the renewd proposal. From what I saw in a quick look it shares some common ideas with the current available implementation. On 01 Aug 2007, at 01:33, Kevin McArthur wrote: This should be rolled into the larger thinking on Zend_Form in general. There's been some API brainstorming going around, but no concrete implementation figured out as of yet to my knowledge. K - Original Message - From: Simon Mundy mailto:[EMAIL PROTECTED] To: Zend Framework General mailto:fw-general@lists.zend.com Sent: Tuesday, July 31, 2007 5:25 PM Subject: [fw-general] Zend_Form_Controller is now a Helper! Hi Ziffers Have just updated the dusty old proposal that was Zend_Form_Controller. It was looking a bit creaky and unwieldy as an extension of the Zend_Controller_Action_Abstract so it's now using the new Helper architecture. It's essentially a way to manage multi-form submissions within a single controller, using each action as a step along the way. Hope you like it - let me know if you have any comments, queries, etc. The code skeleton is more of a fit and healthy body - you can copy and paste it and use as-is if you're feeling adventurous. Look forward to your feedback! http://framework.zend.com/wiki/display/ZFPROP/Zend_Controller_Action_Helper_Multiform+Proposal+-+Simon+Mundy -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com http://www.peptolab.com/
Re: [fw-general] Session problem
Thanks Darby. I will check and try it! Regards, Darby Felton wrote: Would you please take a look at ZF-1743 and ZF-1720? Maybe the problem you are experiencing is related in some way to one or both of these: http://framework.zend.com/issues/browse/ZF-1743 http://framework.zend.com/issues/browse/ZF-1720 If it's not the same problem, please create a new issue, along with the code needed to reproduce the problem. Please also post the version of PHP you are using and on what platform (e.g., RHEL 4, Win32). Thank you! Best regards, Darby minglee wrote: Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11956340 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Session problem
Thanks Ralph, I will check and try it. Regards. Ralph Schindler wrote: I have just tested your code (in two scripts) and it seemingly works fine. $ cat test_session1.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; ? Username set. $ cat test_session2.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); ? Username is: ?= $authNamespace-user; ? I request session1 file, then request session2 file and i get back the username set in session1 file. Troubleshooting: do you have error's being suppressed by php (or are redirected to the error_log? Perhaps the default /tmp location is not writable? Are you sure you are working in an environment (valid hostname) that can set cookies on your client (browser?) These are a few of the outside factors that might affect your ability to be able to use ext/session in general. -ralph minglee wrote: Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11956341 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Zend_Form_Controller is now a Helper!
To get things started here is one potential API for an inline form. This would be combined with a significant view helper to repopulate failed fields and display error messages in detail. Thoughts? K public function formAction() { //Fetch a form from session or create new. $form = Zend_Form::getForm('form-name', 'POST'); //Check if the form has been initialized before if(!$form-hasFields()) { //Initialize form //Add a manual text type field and manually add validators $form-addField(new Zend_Form_Field_Text('first_name')) -addValidator('handle', new Zend_Validate_StringLength(1,64)); -addMessage( 'handle', '%field% is too short', Zend_Validate_StringLength::TOO_SHORT ); } //If the last form submission was invalid add a captcha if($form-hasProcessed() !$form-isValid()) { $form-addField(new Zend_Form_Field_Captcha('prove_human')); } if($form-process()) { //Data was submitted and the form processed if($form-isValid()) { $this-_helper-redirector-goto('next-step'); } else { $this-_helper-redirector-goto('form'); } } else { //This is not a form submission $this-view-form = $form; } } - Original Message - From: Andi Gutmans To: Simon Mundy Cc: Jurriën Stutterheim ; Zend Framework General Sent: Wednesday, August 01, 2007 7:00 PM Subject: RE: [fw-general] Zend_Form_Controller is now a Helper! We like torturing him :) From: Simon Mundy [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 5:58 PM To: Andi Gutmans Cc: Jurriën Stutterheim; Zend Framework General Subject: Re: [fw-general] Zend_Form_Controller is now a Helper! First the tough task of MVC, now the contentious Form! What's Matthew done in another life to deserve this?! ;-) Look forward to the next stage and contributing where possible. Cheers I have asked Matthew from the framework team to do the same with forms as he did with MVC. He will lead forms from our side and work with all the proposal authors and the community to aggregate the ideas into one final proposal and roadmap. So all of you who have written some good proposals or have voiced various opinions, this is when all that work will finalize come to fruitition. I believe Matthew will be able to start in the coming days and then the real fun will begin :) Andi From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 2:00 AM To: Zend Framework General Subject: Re: [fw-general] Zend_Form_Controller is now a Helper! Zend_Form has been discussed a lot the past few days on #zftalk. I also started working on an implementation. For more details see a link on my comment at the Zend_Form proposal. The code will change a lot in the comming days though. I'll have a look at the renewd proposal. From what I saw in a quick look it shares some common ideas with the current available implementation. On 01 Aug 2007, at 01:33, Kevin McArthur wrote: This should be rolled into the larger thinking on Zend_Form in general. There's been some API brainstorming going around, but no concrete implementation figured out as of yet to my knowledge. K - Original Message - From: Simon Mundy To: Zend Framework General Sent: Tuesday, July 31, 2007 5:25 PM Subject: [fw-general] Zend_Form_Controller is now a Helper! Hi Ziffers Have just updated the dusty old proposal that was Zend_Form_Controller. It was looking a bit creaky and unwieldy as an extension of the Zend_Controller_Action_Abstract so it's now using the new Helper architecture. It's essentially a way to manage multi-form submissions within a single controller, using each action as a step along the way. Hope you like it - let me know if you have any comments, queries, etc. The code skeleton is more of a fit and healthy body - you can copy and paste it and use as-is if you're feeling adventurous. Look forward to your feedback! http://framework.zend.com/wiki/display/ZFPROP/Zend_Controller_Action_Helper_Multiform+Proposal+-+Simon+Mundy -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61
Re: [fw-general] Session problem
Hi, Ralph, My problem is gone. I made a mistake: I retrieved session in view, so failed. But I have another question: Where shall put sentences: require_once 'Zend/Session.php'; Zend_Session::start(); I put them in bootstrap, but failed. Then I put it in init() of controller, it worked. So is init() of controller the only place that I shall put the two sentences? Best regards, minglee Ralph Schindler wrote: I have just tested your code (in two scripts) and it seemingly works fine. $ cat test_session1.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; ? Username set. $ cat test_session2.php ? require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); ? Username is: ?= $authNamespace-user; ? I request session1 file, then request session2 file and i get back the username set in session1 file. Troubleshooting: do you have error's being suppressed by php (or are redirected to the error_log? Perhaps the default /tmp location is not writable? Are you sure you are working in an environment (valid hostname) that can set cookies on your client (browser?) These are a few of the outside factors that might affect your ability to be able to use ext/session in general. -ralph minglee wrote: Darby Felton wrote: Hello, Hi, Darby, My error, I did what you suggest, but failed. Try: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); echo $authNamespace-user; Best regards, Darby minglee wrote: Hi, I have session problem, which may be stupid: I set a session: require_once 'Zend/Session/Namespace.php'; $authNamespace = new Zend_Session_Namespace('Zend_Auth'); $authNamespace-user = myusername; How can I retrieve it from ANOTHER page? I used echo $authNamespace-user; but failed! Anybody can answer? Regards -- View this message in context: http://www.nabble.com/Session-problem-tf4199306s16154.html#a11957009 Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Best place to store extended classes / custom project classes
Hi, I was wondering where would be the best place to store extended classes ie for custom view renderers for template engines which I have in the View directory, and also project specific classes. Let me know.
Re: [fw-general] Placeholders
Hi thanks for this, it doesnt make sense still though. It would be nice if they were buffered to variables in the view class, so I could just do this in my Flexy or Smarty template {view.body} or {view.getBody()}. The main template would be the one rendered first when I call render with a specific path so not controller / action dependant, render('sitepath/index.html', null, true); in side a fooAction method for instance , and then the page specific template is buffered to $this-view-body or $this-view-getBody(). Pádraic Brady wrote: Hi Dan, A Layout solution has been on the cards for a while now, and such a solution is to be decided on in the near future. For the moment you can read up on the varying solutions offered by the Layout section of Zend_View Enhanced Proposal, and the different strategy of Zend_Layout Proposal on the proposals page: http://framework.zend.com/wiki/display/ZFPROP A lot of folk are in the same boat awaiting a final accepted approach(es) so keep in mind of this and try for something that's easy to replace as a temporary measure. Not the greatest advice admittedly, but that's the reality for now ;). Best regards, Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com - Original Message From: Dan Rossi [EMAIL PROTECTED] To: Zend Framework fw-general@lists.zend.com Sent: Wednesday, August 1, 2007 10:21:32 AM Subject: [fw-general] Placeholders Hi there, I would like to work out how to use placeholders in my script templates, so then i only need to use one main template, and then for each action / controller I can set body content within a html cell or whatever. I dont like the header / body / footer concept as that doesnt work at all with designers and is obviouslly a developer concept. Let me know thanks. Pinpoint customers http://us.rd.yahoo.com/evt=48250/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v9.php?o=US2226cmp=Yahooctv=AprNIs=Ys2=EMb=50who are looking for what you sell.
[fw-general] project baseclass for all controllers
Hi there I was wondering if it was possible to have a baseclass for all controllers, or a bootstrap, so thats its possible to contain reusable methods for all controllers, IE session handling methods, authentication etc. Let me know.
[fw-general] Persistant config
hi there, sorry I should compile these, when i set a config array from a config xml to a registry entry, is this a persistant registry pointer across pages, ie the xml doesnt get parsed each time ? $config = new Zend_Config_Xml('../application/config/config.xml', 'staging'); $registry = Zend_Registry::getInstance(); $registry-set('config', $config); I have this in my bootstrap file. Let me know thanks.
[fw-general] Table DataObjects and Error handling
Sorry about all these questions, the docs are very inconsistent at times, IE a pointer will be shown but it doesnt show how it gets called first. I'm looking at the db table docs, althought its confusing how to automatically generate dataobjects for each of the tables aswell as generate table relationships from INNODB foreign keys. Is there a way to do this and easily manipulate data inside the table and join other tables etc. I currently use PEAR's DB_DataObject but am interested in PDO for performance reasons. My other question is when an exception happens it redirects to /error however I have no idea how to handle errors as yet , or how to extract the messages in the error controller any ideas ? Basically i'd like to be able to have a custom handler and also log to a file via email and file in production mode. But then also display the stack and the message in debug mode. Let me know.
RE: [fw-general] Persistant config
Hi Dan, To my understanding, the framework relies on the frontController instance everytime a request is sent to the application, and since every request went thru the bootstrap file then the config will get parsed each time. Rgds, Michael -Original Message- From: Dan Rossi [mailto:[EMAIL PROTECTED] Sent: Thursday, August 02, 2007 10:07 AM To: Zend Framework Subject: [fw-general] Persistant config hi there, sorry I should compile these, when i set a config array from a config xml to a registry entry, is this a persistant registry pointer across pages, ie the xml doesnt get parsed each time ? $config = new Zend_Config_Xml('../application/config/config.xml', 'staging'); $registry = Zend_Registry::getInstance(); $registry-set('config', $config); I have this in my bootstrap file. Let me know thanks. ---
Re: [fw-general] Zend Mail and SMTP Status Code
Hi Dinh Can you explain what you mean by a 'proper' smtp status code? Do you mean the code returned by the server at the end of the transaction? Or do you need a transcript of the all requests/responses? The Zend_Mail_Transport_Smtp transport object lets you retrieve a connection instance. The connection instance can then give you a complete transcript of the conversation between client and server. E.g. $tr = new Zend_Mail_Transport_Smtp(); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail(); ... etc ... $mail-send(); $log = $tr-getConnection()-getLog(); If you are performing multiple mail send() operations you can also reset the log between each new mail:- $tr-getConnection()-resetLog(); Hope this answers your question. Cheerio Hi all, I can not find any API in Zend_Mail that allows to retrieve proper smtp status code. Am I missing something or I need to do it myself? Thanks, Dinh -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
[fw-general] Zend Mail and SMTP Status Code
Hi all, I can not find any API in Zend_Mail that allows to retrieve proper smtp status code. Am I missing something or I need to do it myself? Thanks, Dinh
Re: [fw-general] Table DataObjects and Error handling
By the way which is the best efficient way to build queries. Using table dataobjects which alrteady has join / field information. The select class or a prepared statements. Im not sure how to use a prepared statement though. Dan Rossi wrote: Sorry about all these questions, the docs are very inconsistent at times, IE a pointer will be shown but it doesnt show how it gets called first. I'm looking at the db table docs, althought its confusing how to automatically generate dataobjects for each of the tables aswell as generate table relationships from INNODB foreign keys. Is there a way to do this and easily manipulate data inside the table and join other tables etc. I currently use PEAR's DB_DataObject but am interested in PDO for performance reasons. My other question is when an exception happens it redirects to /error however I have no idea how to handle errors as yet , or how to extract the messages in the error controller any ideas ? Basically i'd like to be able to have a custom handler and also log to a file via email and file in production mode. But then also display the stack and the message in debug mode. Let me know.
Re: [fw-general] Zend Mail and SMTP Status Code
Hi Mundy, Thanks for your quick response. When I put 'proper smtp status code' I mean I expect to get the smtp status code in digits. Our mail server has set up a set of custom SMTP status codes. So, when I have to deal with this mail server, I need to retrieve the smtp status code to determine which kind of message should be delivered to our customer to describe the proper status of the email sending activities. Therefore, our customers don't need to look up our FAQs to see what actually happens and why it happens. Here is my code require_once 'Zend/Mail.php'; require_once 'Zend/Mail/Transport/Smtp.php'; $transporter = new Zend_Mail_Transport_Smtp('mail.domain.com', $config); Zend_Mail::setDefaultTransport($transporter); $this-_mailer = new Zend_Mail(); $this-_mailer-addHeader('X-MailGenerator', 'CustomerService'); $this-_mailer-setReturnPath('[EMAIL PROTECTED]'); $this-_mailer-setFrom('[EMAIL PROTECTED]', 'Automatic Mail Sender'); $this-_mailer-addTo($email, $fullName); // Email subject title $this-_mailer-setSubject('Account activation'); $this-_mailer-setBodyText($message); try { $this-_mailer-send(); return true; } catch (Exception $ex) { $this-_errorMessage = $ex-getMessage(); // Error message like that: 531 Message_here_ return false; } It is easy to parse the Exception message to get the smtp status code but I am not sure that if Zend_Mail has a specific API to do that task. Thanks, Dinh On 8/2/07, Simon Mundy [EMAIL PROTECTED] wrote: Hi Dinh Can you explain what you mean by a 'proper' smtp status code? Do you mean the code returned by the server at the end of the transaction? Or do you need a transcript of the all requests/responses? The Zend_Mail_Transport_Smtp transport object lets you retrieve a connection instance. The connection instance can then give you a complete transcript of the conversation between client and server. E.g. $tr = new Zend_Mail_Transport_Smtp(); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail(); ... etc ... $mail-send(); $log = $tr-getConnection()-getLog(); If you are performing multiple mail send() operations you can also reset the log between each new mail:- $tr-getConnection()-resetLog(); Hope this answers your question. Cheerio Hi all, I can not find any API in Zend_Mail that allows to retrieve proper smtp status code. Am I missing something or I need to do it myself? Thanks, Dinh -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Nobody in nowhere
Re: [fw-general] Zend Mail and SMTP Status Code
No it doesn't currently but you're welcome to log a JIRA issue as an improvement/feature request. Would be a cinch to add. Cheers Hi Mundy, Thanks for your quick response. When I put 'proper smtp status code' I mean I expect to get the smtp status code in digits. Our mail server has set up a set of custom SMTP status codes. So, when I have to deal with this mail server, I need to retrieve the smtp status code to determine which kind of message should be delivered to our customer to describe the proper status of the email sending activities. Therefore, our customers don't need to look up our FAQs to see what actually happens and why it happens. Here is my code require_once 'Zend/Mail.php'; require_once 'Zend/Mail/Transport/Smtp.php'; $transporter = new Zend_Mail_Transport_Smtp(' mail.domain.com', $config); Zend_Mail::setDefaultTransport($transporter); $this-_mailer = new Zend_Mail(); $this-_mailer-addHeader('X-MailGenerator', 'CustomerService'); $this-_mailer-setReturnPath('[EMAIL PROTECTED]'); $this-_mailer-setFrom('[EMAIL PROTECTED]', 'Automatic Mail Sender'); $this-_mailer-addTo($email, $fullName); // Email subject title $this-_mailer-setSubject('Account activation'); $this-_mailer-setBodyText($message); try { $this-_mailer-send(); return true; } catch (Exception $ex) { $this-_errorMessage = $ex-getMessage(); // Error message like that: 531 Message_here_ return false; } It is easy to parse the Exception message to get the smtp status code but I am not sure that if Zend_Mail has a specific API to do that task. Thanks, Dinh On 8/2/07, Simon Mundy [EMAIL PROTECTED] wrote: Hi Dinh Can you explain what you mean by a 'proper' smtp status code? Do you mean the code returned by the server at the end of the transaction? Or do you need a transcript of the all requests/responses? The Zend_Mail_Transport_Smtp transport object lets you retrieve a connection instance. The connection instance can then give you a complete transcript of the conversation between client and server. E.g. $tr = new Zend_Mail_Transport_Smtp(); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail(); ... etc ... $mail-send(); $log = $tr-getConnection()-getLog(); If you are performing multiple mail send() operations you can also reset the log between each new mail:- $tr-getConnection()-resetLog(); Hope this answers your question. Cheerio Hi all, I can not find any API in Zend_Mail that allows to retrieve proper smtp status code. Am I missing something or I need to do it myself? Thanks, Dinh -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com -- Nobody in nowhere -- Simon Mundy | Director | PEPTOLAB 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000 Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124 http://www.peptolab.com
Re: [fw-general] Table DataObjects and Error handling
Sorry for the questions there is more, is there a standard way of debugging sql queries so it automatically gets the stack as it happens. I currently have to put this at the end of the action method $profiler = $this-db-getProfiler(); foreach($profiler-getQueryProfiles() as $profile) { echo $profile-getQuery().'brbr'; } Dan Rossi wrote: By the way which is the best efficient way to build queries. Using table dataobjects which alrteady has join / field information. The select class or a prepared statements. Im not sure how to use a prepared statement though. Dan Rossi wrote: Sorry about all these questions, the docs are very inconsistent at times, IE a pointer will be shown but it doesnt show how it gets called first. I'm looking at the db table docs, althought its confusing how to automatically generate dataobjects for each of the tables aswell as generate table relationships from INNODB foreign keys. Is there a way to do this and easily manipulate data inside the table and join other tables etc. I currently use PEAR's DB_DataObject but am interested in PDO for performance reasons. My other question is when an exception happens it redirects to /error however I have no idea how to handle errors as yet , or how to extract the messages in the error controller any ideas ? Basically i'd like to be able to have a custom handler and also log to a file via email and file in production mode. But then also display the stack and the message in debug mode. Let me know.
[fw-general] Zend_DB_Select and identifier quoting on order
Hi my query like ... ... .. -order('videoID DESC