Re: [nyphp-talk] Overriding Array's

2007-05-03 Thread Rob Marscher
On May 3, 2007, at 10:57 PM, Joseph Crawford wrote: The main reason is that the default array is created by reading a YAML file. Cool... I figured something like that was going on. Doesn't totally mean you can read the YAML file into class properties... but whatever works. The Zend_Config c

Re: [nyphp-talk] PHP Sessions, Expiration, and all that

2007-05-03 Thread Joseph Crawford
You will want to look at the gc method for clearing the data. I am sure that you can set a lifetime in the php.ini as well but you should look into the custom session handler and see if the flexability meets your needs. -- Joseph Crawford Jr. Zend Certified Engineer Codebowl Solutions, Inc. http

Re: [nyphp-talk] PHP Sessions, Expiration, and all that

2007-05-03 Thread Joseph Crawford
I would suggest creating a custom session handler and storing the sessions in the db, read up on this. http://www.php.net/manual/en/function.session-set-save-handler.php With a custom session handler you can set a timeout and have the sessions deleted from the database after 6 hours passes. A c

[nyphp-talk] PHP Sessions, Expiration, and all that

2007-05-03 Thread Paul Houle
I've been making some modifications on an application that uses PHP sessions for authentication. Our client wants sessions to time out after six hours of inactivity, and I'm wondering if there's an easy way to do that by configuring PHP. session.cookie_lifetime sets the lifetime of t

Re: [nyphp-talk] Overriding Array's

2007-05-03 Thread Andy Dirnberger
Sorry about that email everyone. Sent via BlackBerry from Cingular Wireless -Original Message- From: "Joseph Crawford" <[EMAIL PROTECTED]> Date: Thu, 3 May 2007 22:57:12 To:"NYPHP Talk" Subject: Re: [nyphp-talk] Overriding Array's Rob, Thanks for your code example however having the

Re: [nyphp-talk] Overriding Array's

2007-05-03 Thread Andy Dirnberger
Like really sad. Sent via BlackBerry from Cingular Wireless -Original Message- From: "Joseph Crawford" <[EMAIL PROTECTED]> Date: Thu, 3 May 2007 22:57:12 To:"NYPHP Talk" Subject: Re: [nyphp-talk] Overriding Array's Rob, Thanks for your code example however having them as class prope

Re: [nyphp-talk] Overriding Array's

2007-05-03 Thread Joseph Crawford
Rob, Thanks for your code example however having them as class properties will not work. The main reason is that the default array is created by reading a YAML file. The array is populated by reading a section of a flat file and then it reads a section specific to the current page (if any) and

Re: [nyphp-talk] Overriding Array's

2007-05-03 Thread Rob Marscher
On May 2, 2007, at 1:52 PM, Joseph Crawford wrote: We are looking to have the second array override the first array values. I cannot seem to get any of these methods to work. I assume you've fixed this by now... but here's a recursive method that I think does what you want: // overrides no

Re: [nyphp-talk] next() for multidimensional arrays?

2007-05-03 Thread David Krings
Che Hodgins wrote: Hi David, see below. On 5/2/07, David Krings <[EMAIL PROTECTED]> wrote: Hi! Is there anything available like next() that will work on multidimensional arrays? First of all, thanks for pointing out my brain fart with using the same key for different values. Second, what I

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Jon Baer
Not sure it has to be that complicated ... Im not sure what framework you are using but the point is that you also eval() the response you get back @ status 412 and send back something like such in a simple example: server.php header("HTTP/1.0 412 Precondition failed"); header("Content-Type

RE: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Mark Armendariz
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Mintz Thank you! This is consistent with what I'm trying to do, I just wanted to confirm that my approach is basically sane. Your example gives me something to study and steal from. Hope it helps. I noticed I made a mista

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread David Mintz
Thank you! This is consistent with what I'm trying to do, I just wanted to confirm that my approach is basically sane. Your example gives me something to study and steal from. On 5/3/07, Mark Armendariz <[EMAIL PROTECTED]> wrote: >>> From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf

RE: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Mark Armendariz
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Mintz >>>I have experimented with converting a PHP array of error messages (fieldName => errorMessage, etc) into JSON and sending that back, then doing DOM scripting to stick the error messages into some DIVs. Kind of a l

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread David Mintz
Yes, I got the part about the HTTP response code. I am trying to pose a question about what else to do if validation fails, i.e., req.status == 412: send back the redrawn form w/ errors and display it, or send back just the validation error messages as a JSON object and work with that? On 5/3/

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Tim Lieberman
Oh, cool. -Tim On May 3, 2007, at 1:25 PM, Felix Shnir wrote: Jon means that the response status should be 412... var req = this.getTransport(); req.open('POST', uri, true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Felix Shnir
Jon means that the response status should be 412... var req = this.getTransport(); req.open('POST', uri, true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) var r = eval(req.responseText);

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread David Mintz
Not sure I follow completely. Are you saying send back 412 and otherwise do it the way I'm doing it, i.e., iterate through a returned Javascript object stuffing the errors into the DIVs? Is it "wrong" to send back the whole HTML form with the error messages? On 5/3/07, Jon Baer <[EMAIL PROTECTED]

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Jon Baer
Send back a 412 (precondition failed) error and evaluate the

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread David Mintz
Ah so, makes sense. The thing about the JSON header is nice. But I want to show the each message in a DIV adjacent to the corresponding form element. So sending one HTML fragment of error text wouldn't quite do it. On 5/3/07, Tim Lieberman <[EMAIL PROTECTED]> wrote: If there are validation erro

Re: [nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread Tim Lieberman
If there are validation errors, send back a json-encoded false in the X-JSON header, and some error HTML to be injected into a DOM element in the body. If there are no errors, send back a json-encoded true in the X-JSON header, and do whatever else you need in the responseText. So your sc

[nyphp-talk] Ajax 101: what to return from a POST

2007-05-03 Thread David Mintz
Let's say you are displaying a form populated with data from a db table for a user to edit, and you want to AJAXify(with Prototype). Your backend script does the validation. Suppose they POST it and validation fails, what do you do? I have experimented with converting a PHP array of error message

Re: [nyphp-talk] Any alternatives to mbstring for PHP+UTF-8?

2007-05-03 Thread Jon Baer
Yes ... ive used the mysql function listed on that page (which is normally where 1/2 problems exist anyways). Just make sure it is installed (depending on your PHP version) ... [PowerbookG4:~]$ php -m | grep iconv iconv Otherwise you might have to compile/install http://www.gnu.org/ software

Re: [nyphp-talk] Any alternatives to mbstring for PHP+UTF-8?

2007-05-03 Thread Jakob Buchgraber
Jon Baer wrote: Iconv is way more flexible ... http://us.php.net/iconv Specifically the alternate ob handler ... http://us.php.net/manual/en/function.ob-iconv-handler.php - Jon Hey! Thanks a lot. Seems to be quite cool. Have you ever used it? How does it perform? And when I convert a UTF-

Re: [nyphp-talk] Any alternatives to mbstring for PHP+UTF-8?

2007-05-03 Thread Jon Baer
Iconv is way more flexible ... http://us.php.net/iconv Specifically the alternate ob handler ... http://us.php.net/manual/en/ function.ob-iconv-handler.php - Jon On May 3, 2007, at 11:31 AM, Jakob Buchgraber wrote: Hey! I was wondering whether there are alternatives to mbstring for hand

Re: [nyphp-talk] Casting string "false" to boolean

2007-05-03 Thread Jakob Buchgraber
Rob Marscher wrote: If you're getting input for a false value as "false" you should really use some kind of conditional statement. Yeah... like this: $string = 'false'; $bool = ($string != 'false'); var_dump($bool); -Rob ___ New York PHP Communit

[nyphp-talk] Any alternatives to mbstring for PHP+UTF-8?

2007-05-03 Thread Jakob Buchgraber
Hey! I was wondering whether there are alternatives to mbstring for handling UTF-8 encoded data with PHP? I am asking, because I'd like to play around with as many "technologies" as possible before I actually start developing. I somehow also looked at the way Joomla! did it, but I don't really