[PHP] php.net down?
Anybody noticed php.net is down? It's responding to pings. But no pages load. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
2009/7/16 Thijs Lensselink p...@addmissions.nl Anybody noticed php.net is down? It's responding to pings. But no pages load. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php UK servers are working: uk2.php.net
Re: [PHP] php.net down?
On Thursday 16 July 2009 11:30:52 Thijs Lensselink wrote: Anybody noticed php.net is down? It's responding to pings. But no pages load. I thought it was just me, guess not! What are we going to do?! -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
Yeah noticed this fact also, try one mirror for example us.php.net or de.php.net There are also a lot of other mirrors ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
Hmm, I thought it was just me, guess not! What are we going to do?! regarding to this question we should use the mirrors provided until this problem is solved ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exception not being caught
2009/7/15 Weston C west...@gmail.com: ?php class A { } $a = new A(); // Ayn would be proud, right? try { echo a is ,$a,\n; } catch(Exception $e) { echo \nException Caught: ; echo $e, $n; } ? This does not run as expected. I'd think that when the implicit string conversion in the try block hits, the exception would be thrown, caught by the catch block, and relayed. Instead you don't ever see the words exception caught and you get Catchable fatal error: Object of class A could not be converted to string. If it's catchable, why isn't it caught in my example? It's not an exception, it's a fatal error. Fatal errors are caught by error handling functions, not by catch blocks. Consequence of having (at least) two separate error handling mechanisms in the same language. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.net down?
Thijs Lensselink schrieb: Anybody noticed php.net is down? It's responding to pings. But no pages load. no -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sub Menu System?
Folks, I'm developing a rather large site in PHP. The main horizontal nav bar never changes, no matter how deep you are in the site. However, on the left side is a vertical sub-menu system. This menu is proving to be a real pain to program. I have it limited the menu system to 3 levels: MAIN: |___Secondary pages |___Tertiary pages For each level, and each folder, I have a file called subnav.php, which contains the links for that page. It has its own code to determine the page it's on, and highlight the appropriate menu item. The problem is when I need to move pages, or add pages, it's proving to be a REAL PAIN to maintain this type of structure. Does anyone know of any off-the-shelf product that can create/maintain a sub-menu system like this? I don't mind starting over at this point, but I'm hoping there is something I can just purchase, so I can concentrate on the rest of the sitehopefully the menu system would support PHP and ASP. Thanks for any information! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabetical pagination (RESOLVED)
Here is what finally worked: ?php$letter = isset($_GET['letter']) ? $_GET['letter'] : A; //alphabetical pagination links echo 'div align=centerb'; foreach(range('A','Z') as $c){ ($letter == $c) ? printf('%snbsp',$c) : printf('a href=?letter=%s%s/anbsp;',$c,$c); }echo /b/divp; //Show all restaurants that start with $letter$sql = SELECT * FROM restaurants WHERE name LIKE '{$letter}%'; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ printf('div align=left width=100b%s/bbr%s/br%s/br/divhr color=#000 width=200/hr',$row['name'],$row['address'],$result['cviolations']); } ? Thanks again everyone!! On 7/15/09 10:48 AM, tedd tedd.sperl...@gmail.com wrote: At 8:29 AM -0700 7/15/09, Miller, Terion wrote: Hi all thanks for all the suggestions, I really had no idea this was going to be so difficult.. I think you are making it more difficult than it has to be. Please review what I said and try it out. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exception not being caught
There are many examples of error_handlers at http://ar.php.net/manual/es/function.set-error-handler.php The handler only have to cast the error to exception. YOu can write a simple handler or a fully featured one, but the essence is the same... function errorHandler(/*args*/) { $e = new Exception( $message, $code ); throw $e; } On Thu, Jul 16, 2009 at 8:42 AM, David Otton phpm...@jawbone.freeserve.co.uk wrote: 2009/7/15 Weston C west...@gmail.com: ?php class A { } $a = new A(); // Ayn would be proud, right? try { echo a is ,$a,\n; } catch(Exception $e) { echo \nException Caught: ; echo $e, $n; } ? This does not run as expected. I'd think that when the implicit string conversion in the try block hits, the exception would be thrown, caught by the catch block, and relayed. Instead you don't ever see the words exception caught and you get Catchable fatal error: Object of class A could not be converted to string. If it's catchable, why isn't it caught in my example? It's not an exception, it's a fatal error. Fatal errors are caught by error handling functions, not by catch blocks. Consequence of having (at least) two separate error handling mechanisms in the same language. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Martin Scotta
Re: [PHP] Sub Menu System?
you can make the menu based on the files. Open the directory, read the files and save some sort of cache that use the site. When you need to move something, just delete the cache an let php do the rest. On Thu, Jul 16, 2009 at 9:55 AM, David Stoltz dsto...@shh.org wrote: Folks, I'm developing a rather large site in PHP. The main horizontal nav bar never changes, no matter how deep you are in the site. However, on the left side is a vertical sub-menu system. This menu is proving to be a real pain to program. I have it limited the menu system to 3 levels: MAIN: |___Secondary pages |___Tertiary pages For each level, and each folder, I have a file called subnav.php, which contains the links for that page. It has its own code to determine the page it's on, and highlight the appropriate menu item. The problem is when I need to move pages, or add pages, it's proving to be a REAL PAIN to maintain this type of structure. Does anyone know of any off-the-shelf product that can create/maintain a sub-menu system like this? I don't mind starting over at this point, but I'm hoping there is something I can just purchase, so I can concentrate on the rest of the sitehopefully the menu system would support PHP and ASP. Thanks for any information! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Martin Scotta
Re: [PHP] Scope of Variables and use of global and this-var
On Jul 15, 2009, at 3:28 PM, tedd wrote: My way -- every time I open a database, I do so by including the configuration.php file that holds the logon/password et other data to connect with the database. When I'm done with what I want from the database, I close it. If one does not close it, then what are the consequences? And do any consequences persist, and how? Or is it just a consideration for a limited time? What limits the risk? In case there is a good article about this, I'd love a link.. Thanks! -G Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scope of Variables and use of global and this-var
On Thu, Jul 16, 2009 at 9:53 AM, Govindagovinda.webdnat...@gmail.com wrote: On Jul 15, 2009, at 3:28 PM, tedd wrote: My way -- every time I open a database, I do so by including the configuration.php file that holds the logon/password et other data to connect with the database. When I'm done with what I want from the database, I close it. If one does not close it, then what are the consequences? And do any consequences persist, and how? Or is it just a consideration for a limited time? What limits the risk? In case there is a good article about this, I'd love a link.. Thanks! -G Cheers, tedd If you're not using persistent connections, they'll all get closed when the script completes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabetical pagination (RESOLVED)
On Thu, Jul 16, 2009 at 9:33 AM, Miller, Teriontmil...@springfi.gannett.com wrote: Here is what finally worked: ?php $letter = isset($_GET['letter']) ? $_GET['letter'] : A; //alphabetical pagination links echo 'div align=centerb'; foreach(range('A','Z') as $c){ ($letter == $c) ? printf('%snbsp',$c) : printf('a href=?letter=%s%s/anbsp;',$c,$c); } echo /b/divp; //Show all restaurants that start with $letter $sql = SELECT * FROM restaurants WHERE name LIKE '{$letter}%'; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ printf('div align=left width=100b%s/bbr%s/br%s/br/divhr color=#000 width=200/hr',$row['name'],$row['address'],$result['cviolations']); } ? Thanks again everyone!! Terion, I hope that isn't your final answer. This has SQL injection written all over it since you are neither validating that $letter is actually a letter, nor are you escaping it before passing it off to MySQL. ?php $letter = isset($_GET['letter']) ? $_GET['letter'] : 'A'; if (!preg_match('/^[A-Z]$/i', $letter) { $letter = 'A'; /* Rather than setting $letter to 'A' and continuing, you could generate an error if you end up in here so you can let the user know that what they passed was invalid. */ } // ? In this case, it should be safe to use $letter directly in the query without passing it through mysql_real_escape_string() since it should only contain a single harmless alphanumeric letter, but it wouldn't hurt (and may still be a good idea) to go ahead and escape the value in the query anyway just in case something in your code changes later that might cause some cruft to slip in. Andrew
Re: [PHP] Alphabetical pagination (RESOLVED)
On Thu, Jul 16, 2009 at 12:01 PM, Miller, Terion tmil...@springfi.gannett.com wrote: One question I still have...I had help with this script of course and I'm confused with the %s what does it do? On 7/16/09 9:53 AM, Martin Scotta martinsco...@gmail.com wrote: On Thu, Jul 16, 2009 at 11:01 AM, Andrew Ballard aball...@gmail.com wrote: On Thu, Jul 16, 2009 at 9:33 AM, Miller, Teriontmil...@springfi.gannett.com wrote: Here is what finally worked: ?php$letter = isset($_GET['letter']) ? $_GET['letter'] : A; //alphabetical pagination links echo 'div align=centerb'; foreach(range('A','Z') as $c){ ($letter == $c)? printf('%snbsp',$c) : printf('a href=?letter=%s%s/anbsp;',$c,$c); } echo /b/divp; //Show all restaurants that start with $letter $sql = SELECT * FROM restaurants WHERE name LIKE '{$letter}%'; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ printf('div align=left width=100b%s/bbr%s/br%s/br/divhr color=#000 width=200/hr',$row['name'],$row['address'],$result['cviolations']); } ? Thanks again everyone!! Terion, I hope that isn't your final answer. This has SQL injection written all over it since you are neither validating that $letter is actually a letter, nor are you escaping it before passing it off to MySQL. ?php $letter = isset($_GET['letter']) ? $_GET['letter'] : 'A'; if (!preg_match('/^[A-Z]$/i', $letter) { $letter = 'A'; /* Rather than setting $letter to 'A' and continuing, you could generate an error if you end up in here so you can let the user know that what they passed was invalid. */ } // ? In this case, it should be safe to use $letter directly in the query without passing it through mysql_real_escape_string() since it should only contain a single harmless alphanumeric letter, but it wouldn't hurt (and may still be a good idea) to go ahead and escape the value in the query anyway just in case something in your code changes later that might cause some cruft to slip in. Andrew My point of view: # i'll use constants for these values assert( ord('A') == 0x41 ); assert( ord('Z') == 0x5A ); # 1. get the ascii code of the 1st character or from A=0x41 $letter = ord( array_key_exists('letter', $_GET) ? strtoupper( $_GET['letter']{0} ) : 'A' ); # 2. different solutions # 2.a check if it is range ussing = ussing constants (faster) $letter = chr( 0x41= $letter $letter = 0x5A ? $letter : 0x41 ); # 2. different solutions # 2.b check if it is range min/max and with constants (faster) $letter = chr( min( max(0x41, $letter), 0x5A) ); I'd use the 2.b but this has different behaviour when $letter Z (should this ever happen?) In the other hand I think it is the faster one. printf has it's own mini-syntax. This was implemented in C. PHP's printf syntax is very similar, but with some cool add-ons http://php.net/printf The detailed description of format are here: http://php.net/sprintf -- Martin Scotta
[PHP] Add php.net to my browser search box
Hi all! I'd like to add php.net to my browser search box. Most browser can do it by looking at some XML provided by the site. The HTML must contain a simple link tag like this link rel=search type=application/opensearchdescription+xml title=PHP.net href=http://php.net/osd.xml; / and osd.xml should be something like this ?xml version=1.0 encoding=utf-8? OpenSearchDescription ShortNamePHP.net/ShortName DescriptionQuick search in PHP.net!/Description Tagsphp quick search/Tags Image height=16 width=16 type=image/x-icon http://php.net/images/logos/php-icon-white.gif/Image Url type=text/html method=GET template= http://search.php?pattern={searchTerms}/ InputEncodingUTF-8/InputEncoding AdultContentfalse/AdultContent /OpenSearchDescription I know php.net use method=POST, but it's quite easy to provide a GET mechanism. is this the correct place for posting this? -- Martin Scotta
Re: [PHP] Add php.net to my browser search box
On Thu, Jul 16, 2009 at 11:59, Martin Scottamartinsco...@gmail.com wrote: Hi all! I'd like to add php.net to my browser search box. Most browser can do it by looking at some XML provided by the site. I had written one about two and a half years ago. It's the dumbest, simplest thing, and yet it's now been downloaded over 30,000 times. Nuts. If you want to use it, or just use the model as a frame to build your own, check it out: http://isawit.com/php_search.php -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Inverting a dependency list
I recall, years ago, having a set of utilities that would build a call tree from application code written in C. This was useful for figuring out dependencies in code that someone else had written. I would like to do something similar with a large PHP application I am now maintaining, but with a slightly different emphasis. This application includes several library files which contain more than 400 function declarations. I need to determine how many of those functions are actually used by the application and which can be culled from the code base. Is there an easy way to determine which of them are called somewhere and then work through the call tree to identify the orphans? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Syntax Snag need extra eyes
I'm almost there with my little pagination script but now I'm hung on the Unexpected T_Variable error...which in the past has been a semi-colon missing so I'm not sure why this is throwing it...eyes please: printf('a href=view.php?name=$row['name']b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Syntax Snag need extra eyes
From: Miller, Terion I'm almost there with my little pagination script but now I'm hung on the Unexpected T_Variable error...which in the past has been a semi-colon missing so I'm not sure why this is throwing it...eyes please: printf('a href=view.php?name=$row['name']b%s/bbr%s/brbr/a',$row['na me'] ,$row['address']); It looks like you have nested single quotes. You probably need to escape the inside set. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes
Miller, Terion wrote: I'm almost there with my little pagination script but now I'm hung on the Unexpected T_Variable error...which in the past has been a semi-colon missing so I'm not sure why this is throwing it...eyes please: printf('a href=view.php?name=$row['name']b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); The single ticks in your array() variable is causing the problem. plus, since you are using single quotes for the entire string, the variable isn't going to be interpreted as a variable. It will simply print the string $row['name'] Also, this is the wrong way to use printf(). Please go read the manual page for this function. Try: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); This is the correct way to use printf() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sub Menu System?
At 8:55 AM -0400 7/16/09, David Stoltz wrote: Folks, I'm developing a rather large site in PHP. The main horizontal nav bar never changes, no matter how deep you are in the site. However, on the left side is a vertical sub-menu system. This menu is proving to be a real pain to program. I have it limited the menu system to 3 levels: MAIN: |___Secondary pages |___Tertiary pages This might help: http://sperling.com/examples/new-menuh/ However, this is not a php script, but rather a simple css solution. The only addition is a javascript routine to handle IE -- without it, IE's are dead. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes (RESOLVED)
Thanks Jim!! I did read the manual and don't get it, like why is printf used and not echo...how do you decided which to use? On 7/16/09 11:25 AM, Jim Lucas li...@cmsws.com wrote: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes
On Thu, Jul 16, 2009 at 12:25 PM, Jim Lucas li...@cmsws.com wrote: Miller, Terion wrote: I'm almost there with my little pagination script but now I'm hung on the Unexpected T_Variable error...which in the past has been a semi-colon missing so I'm not sure why this is throwing it...eyes please: printf('a href=view.php?name=$row['name']b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); The single ticks in your array() variable is causing the problem. plus, since you are using single quotes for the entire string, the variable isn't going to be interpreted as a variable. It will simply print the string $row['name'] Also, this is the wrong way to use printf(). Please go read the manual page for this function. Try: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); This is the correct way to use printf() I like this, just because I don't need to repeat $row['name'] (but it is the same thing): printf( 'a href=view.php?name=%1$sb%1$s/bbr /%2$sbr /br //a', $row['name'], $row['address'] ); Andrew
Re: [PHP] Syntax Snag need extra eyes
Andrew Ballard wrote: On Thu, Jul 16, 2009 at 12:25 PM, Jim Lucas li...@cmsws.com wrote: Miller, Terion wrote: I'm almost there with my little pagination script but now I'm hung on the Unexpected T_Variable error...which in the past has been a semi-colon missing so I'm not sure why this is throwing it...eyes please: printf('a href=view.php?name=$row['name']b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); The single ticks in your array() variable is causing the problem. plus, since you are using single quotes for the entire string, the variable isn't going to be interpreted as a variable. It will simply print the string $row['name'] Also, this is the wrong way to use printf(). Please go read the manual page for this function. Try: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); This is the correct way to use printf() I like this, just because I don't need to repeat $row['name'] (but it is the same thing): printf( 'a href=view.php?name=%1$sb%1$s/bbr /%2$sbr /br //a', $row['name'], $row['address'] ); Andrew I was wondering if that was possible. Thanks for the tip. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes (RESOLVED)
Miller, Terion wrote: Thanks Jim!! I did read the manual and don't get it, like why is printf used and not echo...how do you decided which to use? On 7/16/09 11:25 AM, Jim Lucas li...@cmsws.com wrote: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); I would say personal preference is the main factor. I use echo mostly. Some people like print() and some line printf() sprintf(). Probably depends mostly on where you learned to program. Honestly, echo and print() use the same internal PHP construct. From what I understand, one links to the other as an alias or something to that affect. Also, the parenthesis are optional when using echo and print. Back in the day, to be consistent, most people used printf() in C or other similar programming languages. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inverting a dependency list
On Thu, Jul 16, 2009 at 12:09 PM, Bob McConnellr...@cbord.com wrote: I recall, years ago, having a set of utilities that would build a call tree from application code written in C. This was useful for figuring out dependencies in code that someone else had written. I would like to do something similar with a large PHP application I am now maintaining, but with a slightly different emphasis. This application includes several library files which contain more than 400 function declarations. I need to determine how many of those functions are actually used by the application and which can be culled from the code base. Is there an easy way to determine which of them are called somewhere and then work through the call tree to identify the orphans? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php PHPUnit + Xdebug has a really nice code coverage generation. Perhaps you could use the way phpunit hooks into xdebug to figure out likes that get hit in the code base. I don't know of a simple, ready-made solution off the top of my head though. -- http://www.ericbutera.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes
On Thu, Jul 16, 2009 at 12:43 PM, Andrew Ballardaball...@gmail.com wrote: On Thu, Jul 16, 2009 at 12:35 PM, Jim Lucas li...@cmsws.com wrote: Andrew Ballard wrote: On Thu, Jul 16, 2009 at 12:25 PM, Jim Lucas li...@cmsws.com wrote: [snip] Also, this is the wrong way to use printf(). Please go read the manual page for this function. Try: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); This is the correct way to use printf() I like this, just because I don't need to repeat $row['name'] (but it is the same thing): printf( 'a href=view.php?name=%1$sb%1$s/bbr /%2$sbr /br //a', $row['name'], $row['address'] ); Andrew I was wondering if that was possible. Thanks for the tip. Jim Lucas That's what I like about this list. I wasn't totally sure it would work myself, but I was pretty sure it would, and this was another one of those posts that provided just enough prompting for me to actually pop the code into Zend Studio where I could test it pretty quickly. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php another option is to wrap the array elements in curly braces printf('a href=view.php?name={$row['name']}b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Case Conversion of US Person Names
Hi, All -- -- - - I occasionally find myself in need of a utility to do case conversion of people's names, especially when I am converting data from an old to a new system. This is the first such occasion in PHP. I know about ucwords() and mb_convert_case(). They do not accommodate names with middle capitalization. Does anybody have such a utility to share, or know of one posted by someone out there that you have used? I am not looking for perfection -- I know that such is not possible. I just want to pick off the easy ones -- Mc, Mac, O', de, de la, van, vander, van der, d' and others like that. I see some novel attempts to do parts of this on the PHP ucwords() User Notes area, but I bet someone out there has something more comprehensive. I'd rather not roll my own as I have done in other languages. I have Googled without success. Many thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Snag need extra eyes
Bastien Koert wrote: On Thu, Jul 16, 2009 at 12:43 PM, Andrew Ballardaball...@gmail.com wrote: On Thu, Jul 16, 2009 at 12:35 PM, Jim Lucas li...@cmsws.com wrote: Andrew Ballard wrote: On Thu, Jul 16, 2009 at 12:25 PM, Jim Lucas li...@cmsws.com wrote: [snip] Also, this is the wrong way to use printf(). Please go read the manual page for this function. Try: printf( 'a href=view.php?name=%sb%s/bbr /%sbr /br //a', $row['name'], $row['name'], $row['address'] ); This is the correct way to use printf() I like this, just because I don't need to repeat $row['name'] (but it is the same thing): printf( 'a href=view.php?name=%1$sb%1$s/bbr /%2$sbr /br //a', $row['name'], $row['address'] ); Andrew I was wondering if that was possible. Thanks for the tip. Jim Lucas That's what I like about this list. I wasn't totally sure it would work myself, but I was pretty sure it would, and this was another one of those posts that provided just enough prompting for me to actually pop the code into Zend Studio where I could test it pretty quickly. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php another option is to wrap the array elements in curly braces printf('a href=view.php?name={$row['name']}b%s/bbr%s/brbr/a',$row['name'] ,$row['address']); No, that won't work. The string that it is in, was created using single quotes. Therefor the array reference will never be looked at. It will simply print the actuall string, not the value associated to the array reference. Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Case Conversion of US Person Names
U can try this: function fNme($n){ $tN=count($n=explode(' ',strtolower($n))); $nR=''; for($i=0;$i$tN;$i++){if($i==0){$nR.=strlen($n[$i])3?ucwords($n[$i]):$n[$i] ;}else{$nR.=strlen($n[$i])3?' '.ucwords($n[$i]):' '.$n[$i];}} return $nR; } echo fNme('a aaa aa aa '); And also make an array inside this function for exceptions like 'vander' or other words which the srtlen is 3. Zechim -Mensagem original- De: phphelp -- kbk [mailto:phph...@comcast.net] Enviada em: quinta-feira, 16 de julho de 2009 15:00 Para: PHP General List Assunto: [PHP] Case Conversion of US Person Names Hi, All -- -- - - I occasionally find myself in need of a utility to do case conversion of people's names, especially when I am converting data from an old to a new system. This is the first such occasion in PHP. I know about ucwords() and mb_convert_case(). They do not accommodate names with middle capitalization. Does anybody have such a utility to share, or know of one posted by someone out there that you have used? I am not looking for perfection -- I know that such is not possible. I just want to pick off the easy ones -- Mc, Mac, O', de, de la, van, vander, van der, d' and others like that. I see some novel attempts to do parts of this on the PHP ucwords() User Notes area, but I bet someone out there has something more comprehensive. I'd rather not roll my own as I have done in other languages. I have Googled without success. Many thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Case Conversion of US Person Names
On Jul 16, 2009, at 1:19 PM, Jônatas Zechim wrote: U can try this: function fNme($n){ $tN=count($n=explode(' ',strtolower($n))); $nR=''; for($i=0;$i$tN;$i++){if($i==0){$nR.=strlen($n[$i])3?ucwords($n [$i]):$n[$i] ;}else{$nR.=strlen($n[$i])3?' '.ucwords($n[$i]):' '.$n[$i];}} return $nR; } echo fNme('a aaa aa aa '); And also make an array inside this function for exceptions like 'vander' or other words which the srtlen is 3. Thank you. If I roll my own function, that could be useful. I'd still rather find one that exists, though. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dictionary/spell check...
Hi Everyone, This is slightly off topic... We're building an application, and have a need for an opensource dictionary. Basically a way to match words against a dictionary to see if they are valid, and what type of word they are. noun, adv, etc.. Can anyone point me in the right direction? Yes.. I did google already... -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month.
[PHP] Invalid Argument why?
Why is this an invalid argument? foreach(($row['inType']) as $inType){ echo $inType,'br';} I am trying to output results from a data base that may have multiple results for the same name So trying to use an array and foreach that is the right track ...right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Invalid Argument why?
On Thu, 2009-07-16 at 15:41 -0400, Miller, Terion wrote: Why is this an invalid argument? foreach(($row['inType']) as $inType){ echo $inType,'br';} I am trying to output results from a data base that may have multiple results for the same name So trying to use an array and foreach that is the right track ...right? I imagine $row is the array, and ['inType'] is an element of the array. This is not how you use a foreach. Can you show where you are getting $row from? Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dictionary/spell check...
Aspell. Dan Joseph wrote: Hi Everyone, This is slightly off topic... We're building an application, and have a need for an opensource dictionary. Basically a way to match words against a dictionary to see if they are valid, and what type of word they are. noun, adv, etc.. Can anyone point me in the right direction? Yes.. I did google already... -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Invalid Argument why?
Miller, Terion wrote: Why is this an invalid argument? foreach(($row['inType']) as $inType){ echo $inType,'br';} I am trying to output results from a data base that may have multiple results for the same name So trying to use an array and foreach that is the right track ...right? Looks like you meant to do something like this: // Always better to be plural when you have an array. $rows = whatever_your_rows_come_from(); foreach($rows as $row) { $inType = $row['inType']; echo $inType . 'br /'; } HTH, Kyle
Re: [PHP] Invalid Argument why? (RESOLVED)
Actually this ended up doing what I needed: $result = mysql_query($sql) or die(mysql_error()); $header = false; while($row = mysql_fetch_assoc($result)){ if(!$header){ echo ($row['name']),'br'; echo ($row['address']),'br'; $header = true; } echo ($row['inDate']),'br'; echo ($row['inType']),'br'; echo ($row['notes']),'br'; echo ($row['critical']),'br' ; echo ($row['cviolations']),'br'; }} On 7/16/09 2:53 PM, Kyle Smith kyle.sm...@inforonics.com wrote: Miller, Terion wrote: Why is this an invalid argument? foreach(($row['inType']) as $inType){ echo $inType,'br';} I am trying to output results from a data base that may have multiple results for the same name So trying to use an array and foreach that is the right track ...right? Looks like you meant to do something like this: // Always better to be plural when you have an array. $rows = whatever_your_rows_come_from(); foreach($rows as $row) { $inType = $row['inType']; echo $inType . 'br /'; } HTH, Kyle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sub Menu System?
There are a plethora of solutions to do this type of navigation. All of them free. They usually use an UL and LI sections and CSS. You should look into jQuery as it has some of this built in too I believe. Lastly, consider using an array to build your menu with, then you can filter and do authentication and such by simply ripping out array elements (and checking the viewed page against the list) -Original Message- From: David Stoltz [mailto:dsto...@shh.org] Sent: Thursday, July 16, 2009 5:55 AM To: php-general@lists.php.net Subject: [PHP] Sub Menu System? Folks, I'm developing a rather large site in PHP. The main horizontal nav bar never changes, no matter how deep you are in the site. However, on the left side is a vertical sub-menu system. This menu is proving to be a real pain to program. I have it limited the menu system to 3 levels: MAIN: |___Secondary pages |___Tertiary pages For each level, and each folder, I have a file called subnav.php, which contains the links for that page. It has its own code to determine the page it's on, and highlight the appropriate menu item. The problem is when I need to move pages, or add pages, it's proving to be a REAL PAIN to maintain this type of structure. Does anyone know of any off-the-shelf product that can create/maintain a sub-menu system like this? I don't mind starting over at this point, but I'm hoping there is something I can just purchase, so I can concentrate on the rest of the sitehopefully the menu system would support PHP and ASP. Thanks for any information! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dictionary/spell check...
On Thu, Jul 16, 2009 at 3:51 PM, Robert Cummings rob...@interjinn.comwrote: Aspell. Can anyone point me in the right direction? Yes.. I did google already... Thanks! -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month.
Re: [PHP] Invalid Argument why?
foreach iterates over an array or a object (see Traversable ). If you pass anything different he complains ?php if( !is_scalar( $collection ) ) foreach( $collection as $element ) print_r( $element ); On Thu, Jul 16, 2009 at 4:53 PM, Kyle Smith kyle.sm...@inforonics.comwrote: Miller, Terion wrote: Why is this an invalid argument? foreach(($row['inType']) as $inType){ echo $inType,'br';} I am trying to output results from a data base that may have multiple results for the same name So trying to use an array and foreach that is the right track ...right? Looks like you meant to do something like this: // Always better to be plural when you have an array. $rows = whatever_your_rows_come_from(); foreach($rows as $row) { $inType = $row['inType']; echo $inType . 'br /'; } HTH, Kyle -- Martin Scotta
Re: [PHP] Add php.net to my browser search box
Good evening Daniel, thank you for the link... I was searching such tool... Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator Tamay Dogan Network Debian GNU/Linux Consultant Am 2009-07-16 12:09:07, schrieb Daniel Brown: I had written one about two and a half years ago. It's the dumbest, simplest thing, and yet it's now been downloaded over 30,000 times. Nuts. If you want to use it, or just use the model as a frame to build your own, check it out: http://isawit.com/php_search.php END OF REPLIED MESSAGE -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack c/o Shared Office KabelBW ICQ #328449886 +49/177/9351947Blumenstasse 2 MSN LinuxMichi +33/6/61925193 77694 Kehl/Germany IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Characters causing problems in search strings?
My little browse /search restaurant project is coming along, but I just noticed that any restaurant with a , () or # in the name like say for example Arby's Store #12 ...will not return results... Yet if a name has a / or a - it's not a problem... 1. why is this and how do and where do I escape those characters on the query? Or on the insert? Thanks in Advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Internal PHP caching methodology
Hello, Call me a dreamer...but I got to ask. Is there any software for helping speed up PHP by utilizing internal PHP caching? I am not talking about the external php cache/header control. Smarty caching doesn't give me the control I need either. I would like to cache to a finer level than page by page, but rather on a module by module basis. Each of my pages contains a subset of modules. The content of these modules changes based upon certain criteria (link, time, session data, but is sometimes static across the site). I would like to be able to cache individual modules (preferably based upon frequency and time to generate). I am trying to develop a way to do this, but I have to think a brighter mind has come before me and hopefully arrived at a solution. As always any help/thoughts are much appreciated, except for that one guy's comments (you all know who I am talking) ~ jk ;) Thanks, ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Case Conversion of US Person Names
On Jul 16, 2009, at 4:06 PM, Leonard Burton wrote: Try this class here: http://code.google.com/p/lastname/ Oo! That looks *very* interesting. Thank you. Have you tried it? Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internal PHP caching methodology
On Jul 16, 2009, at 5:50 PM, Daniel Kolbo kolb0...@umn.edu wrote: Hello, Call me a dreamer...but I got to ask. Is there any software for helping speed up PHP by utilizing internal PHP caching? I am not talking about the external php cache/header control. Smarty caching doesn't give me the control I need either. I would like to cache to a finer level than page by page, but rather on a module by module basis. Each of my pages contains a subset of modules. The content of these modules changes based upon certain criteria (link, time, session data, but is sometimes static across the site). I would like to be able to cache individual modules (preferably based upon frequency and time to generate). I am trying to develop a way to do this, but I have to think a brighter mind has come before me and hopefully arrived at a solution. As always any help/thoughts are much appreciated, except for that one guy's comments (you all know who I am talking) ~ jk ;) Thanks, ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Memcache Apc Zend_cache Google php caching Bastien Sent from my iPod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [HEADSUP] rsync going temporarily down
2009/7/16 José Miguel Santibáñez A. j...@caos.cl: Hi, here (http://cl.php.net) we lost all documentation... I'll try a re-sync manually, but nothing happenes... Just a heads-up for those of you reading the newsgroup in real-time and emailing me directly or contacting off the PHP General list, do not worry: the PHP website is not going down. To answer a few of the other questions that were actually asked: * We appreciate the offer, but we do not need a sponsor to buy the php.net domain back. It is still in our control at this time. * Our hosting bills are not overdue. * Do not worry, your government has not [yet] cut off access to the php.net website, but if you still want to download a copy of the manual, you are welcome to do so. * You have not been blacklisted for too many searches. As you can see, things are returning to normal after a minor and temporary glitch. Thank you for your concern, and a special thanks to those who offered assistance when they were concerned that there may be larger issues. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Internal PHP caching methodology
On Thu, Jul 16, 2009 at 5:50 PM, Daniel Kolbokolb0...@umn.edu wrote: Hello, Call me a dreamer...but I got to ask. Is there any software for helping speed up PHP by utilizing internal PHP caching? I am not talking about the external php cache/header control. Smarty caching doesn't give me the control I need either. I would like to cache to a finer level than page by page, but rather on a module by module basis. Each of my pages contains a subset of modules. The content of these modules changes based upon certain criteria (link, time, session data, but is sometimes static across the site). I would like to be able to cache individual modules (preferably based upon frequency and time to generate). I am trying to develop a way to do this, but I have to think a brighter mind has come before me and hopefully arrived at a solution. As always any help/thoughts are much appreciated, except for that one guy's comments (you all know who I am talking) ~ jk ;) Thanks, ` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Have you actually profiled your code to see where the pain points are vs saying 'module?' Are you also running an opcode cache? From there you can use data, block, or full page caching. Finally you can figure out if you want to store it in flat files or memory. I'd start by knowing what is actually the slow part using Xdebug and nail a few down. There is no end all solution. Some pages really don't have a lot going on and are hardly updated so full page is fine. Others might have something that is hard to generate on a sidebar, so block caching would be more suitable for that. As previously mentioned, Zend_Cache is up to the task. There is also a PEAR package called Cache_Lite which would work to if you're interested in file based caching. -- http://www.ericbutera.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Add php.net to my browser search box
On Thu, Jul 16, 2009 at 12:09 PM, Daniel Browndanbr...@php.net wrote: On Thu, Jul 16, 2009 at 11:59, Martin Scottamartinsco...@gmail.com wrote: Hi all! I'd like to add php.net to my browser search box. Most browser can do it by looking at some XML provided by the site. I had written one about two and a half years ago. It's the dumbest, simplest thing, and yet it's now been downloaded over 30,000 times. Nuts. If you want to use it, or just use the model as a frame to build your own, check it out: http://isawit.com/php_search.php -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Interesting content on that site, Dan! -- http://www.ericbutera.us/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Add php.net to my browser search box
On Thu, Jul 16, 2009 at 20:24, Eric Buterae...@ericbutera.us wrote: Interesting content on that site, Dan! One of those situations where I bought a domain name with the intent and desire to do something, and wound up converting it to personal usage. In this case, doing nothing but putting up random crap to do a 1995-style throwback site. Ugly, simple, linear only not Netscape Navigator grey and blue. ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
Thijs Lensselink wrote: Anybody noticed php.net is down? It's responding to pings. But no pages load. I noticed this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [HEADSUP] rsync going temporarily down
Hi, here (http://cl.php.net) we lost all documentation... I'll try a re-sync manually, but nothing happenes... Just a heads-up for those of you reading the newsgroup in real-time and emailing me directly or contacting off the PHP General list, do not worry: the PHP website is not going down. To answer a few of the other questions that were actually asked: (...) * Do not worry, your government has not [yet] cut off access to the php.net website, but if you still want to download a copy of the manual, you are welcome to do so. Ok... We'll wait until documentation be back... I reviewed some mirrors (www, us) and they are all in the same situation: no documentation (not online, not download). Except those who have not been updated today ... Best regards! -- José Miguel Santibáñez http://caos.cl j...@caos.cl A programa pirateado no se le miran las fuentes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [HEADSUP] rsync going temporarily down
On Thu, 16 Jul 2009, José Miguel Santibáñez A. wrote: Hi, here (http://cl.php.net) we lost all documentation... I'll try a re-sync manually, but nothing happenes... Just a heads-up for those of you reading the newsgroup in real-time and emailing me directly or contacting off the PHP General list, do not worry: the PHP website is not going down. To answer a few of the other questions that were actually asked: (...) * Do not worry, your government has not [yet] cut off access to the php.net website, but if you still want to download a copy of the manual, you are welcome to do so. Ok... We'll wait until documentation be back... I reviewed some mirrors (www, us) and they are all in the same situation: no documentation (not online, not download). Except those who have not been updated today ... en is now in the rsync space again, all other languages will follow. regards, Derick -- http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org twitter: @derickr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
Daniel Kolbo wrote: Thijs Lensselink wrote: Anybody noticed php.net is down? It's responding to pings. But no pages load. I noticed this They probably just have their asp.net module misconfigured. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net down?
On Thu, Jul 16, 2009 at 21:55, Michael A. Petersmpet...@mac.com wrote: They probably just have their asp.net module misconfigured. IIS crashed. We tried to CTRL+ALT+DEL, but it didn't work. We've been on the phone with Tech Support for nine hours, and hope to be able to install Service Pack 31 next week. [Now for the real (canned) response.] We're aware of the issue, and thanks for your report. For more information, please see this thread on our newsgroups: http://news.php.net/php.mirrors/37458 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php