php-general Digest 16 May 2009 13:15:18 -0000 Issue 6124
php-general Digest 16 May 2009 13:15:18 - Issue 6124 Topics (messages 292666 through 292678): Re: CSS tables 292666 by: Michael A. Peters 292667 by: Michael A. Peters 292669 by: Paul M Foster 292670 by: Paul M Foster 292673 by: Ashley Sheridan 292674 by: Bas Avezaat 292678 by: Robert Cummings Re: Sorting times (SOLVED) 292668 by: German Geek Re: read the last line in a file? 292671 by: Per Jessen Re: Software to read/write Excel to CD? 292672 by: Ashley Sheridan Shopping Cart 292675 by: Vernon St Croix 292676 by: Ashley Sheridan 292677 by: Darrel St Croix Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- tedd wrote: At 2:06 PM -0400 5/15/09, Tom Worster wrote: for one thing, a table is a great way of representing relations (http://mathworld.wolfram.com/Relation.html). data tables are the canonical example but very often a form's structure is a relation, e.g. between labels and input fields, or between multiple input fields. some of the best designed and behaving web sites i know use tables in ways that a list apart would consider heathen. Heresy! :-) However, there are occasions such as in a calendar where not using a table would be more than difficult. Calendars are tabular data and thus a table is right way to do it. ---End Message--- ---BeginMessage--- Nathan Rixham wrote: tedd wrote: At 2:06 PM -0400 5/15/09, Tom Worster wrote: for one thing, a table is a great way of representing relations (http://mathworld.wolfram.com/Relation.html). data tables are the canonical example but very often a form's structure is a relation, e.g. between labels and input fields, or between multiple input fields. some of the best designed and behaving web sites i know use tables in ways that a list apart would consider heathen. Heresy! :-) However, there are occasions such as in a calendar where not using a table would be more than difficult. I haven't received a decree yet as to IF that would be considered column data or not. I'm gonna differ on this one, when you simply float each calender item to the left you're pretty much done, in many cases i find it easier than tables. But with tables, you can use th and td elements to describe the tabular data, and non visual browsers will know what to do with those tags to better describe the data in the table. Also, by using a table, you don't end up with funny display should the calendar be displayed in a small browser window. Yes, you'll end up with the dreaded horizontal scroll bar in a small window, but in the case of tabular data, that's what should happen. The only way to accomplish a div/css solution is with absolute position. Positioning tabular data with divs also goes completely to hell if the user turns of css. Tables still render the tabular data correctly with CSS turned off. That's why tabular data should be done with the table tag. Tables aren't themselves evil, using them for layout it. Example of the proper use of tables: http://www.shastaherps.org/SearchRecords?horder=3page=1 The layout (and I confess, I'm no artistic design guru) is fairly basic div/css based layout. Haven't even tested in IE or Safari (fricken MS and Apple won't port their browsers to Linux) - there may be some CSS issues. The tabular data however (search results) is done the way tabular data should be done - via table. I could have done it with divs but table was the proper tag. All the tables are evil tripe needs to be noted that the tripe is within the scope of layout design, not the scope of tabular data. ---End Message--- ---BeginMessage--- On Fri, May 15, 2009 at 03:12:06PM -0400, HallMarc Websites wrote: Um... sorry to jump in as a late arrival yet there you go What limitations? You could provide a layered layout using CSS and png graphic format. As for setting up columns check out float and clear and you're all set. TABLE, TR, TD, TBODY, etc were never intended to be used in the manner we see today. If you are blind and you hit a site with a mess of nested tables then.. well you might leave because of the garbage you have to listen to when the page loads. Speaking of which, correct me if I am wrong and my info is out of date but TABLEs are loaded one at a time by browsers and cause longer load times than necessary. Tables do take longer to load. The browser has to do a lot of math to determine how wide to make cells, etc. I don't know how this compares with CSS divs and such, speed wise. All in CSS is the way to go. CSS3 will make our lives easier and will contain so many new features
php-general Digest 17 May 2009 01:18:35 -0000 Issue 6125
php-general Digest 17 May 2009 01:18:35 - Issue 6125 Topics (messages 292679 through 292692): Re: CSS tables 292679 by: Daniele Grillenzoni 292688 by: Stephen 292689 by: Robert Cummings 292690 by: Ashley Sheridan 292691 by: Robert Cummings 292692 by: Stephen Parsing of forms 292680 by: Daniele Grillenzoni 292681 by: Daniele Grillenzoni 292682 by: Daniele Grillenzoni 292683 by: Daniele Grillenzoni Fileinfo and MSWord bug 292684 by: b Re: read the last line in a file? 292685 by: Tom Worster Re: Shopping Cart 292686 by: Daniel Brown 292687 by: Shawn McKenzie Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On 15/05/2009 19.25, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? A table, meaning ONE table for tough layouts could solve many problems, specially for newbies, but tbh there are enough resources to do pretty much whatever you need to do with css if the layout doesn't have absurd constraints. Most of the IE bugs are due to floating and clearing, once you have learned to master overflow: auto and display: inline, you're good to go. Just don't get insane about trying to achieve pixel perfect in netscape4. ---End Message--- ---BeginMessage--- PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. CSS 2.1 makes layout easy ans IE8 passes ACID2. I have some javascript that detects the browser and warns users of IE 8 that they need to upgrade. Maybe bleeding edge for commercial sites, but helping the user upgrade is going them a favour. Stephen ---End Message--- ---BeginMessage--- On Sat, 2009-05-16 at 19:48 -0400, Stephen wrote: PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. CSS 2.1 makes layout easy ans IE8 passes ACID2. I have some javascript that detects the browser and warns users of IE 8 that they need to upgrade. Maybe bleeding edge for commercial sites, but helping the user upgrade is going them a favour. Stephen Tell that to government... many, and in some departments most, are still using IE6. I'm quite sure they won't appreciate me telling them it's time to upgrade. On the plus side though, MediaWiki is breaking ground :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- On Sat, 2009-05-16 at 09:15 -0400, Robert Cummings wrote: On Sat, 2009-05-16 at 10:48 +0100, Ashley Sheridan wrote: On Sat, 2009-05-16 at 02:25 -0400, Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster I think the
Re: [PHP] Sorting times (SOLVED)
Just a draft i thought should not go unnoticed on the list :-) just cleaning up. OK, How about a super efficient soln where each string is only converted once and a fast sorting algorithm is used: ?php function time_sort($a, $b) { static $now = time(); if (strtotime($a, $now) == strtotime($b, $now)) { return 0; } return (strtotime($a, $now) strtotime($b, $now) ? -1 : 1; } function sortTime($times) { } Tim-Hinnerk Heuer http://www.ihostnz.com Fred Allen - California is a fine place to live - if you happen to be an orange. 2009/2/16 Shawn McKenzie nos...@mckenzies.net tedd wrote: At 9:31 PM -0600 2/14/09, Shawn McKenzie wrote: Yeah, hif I had known that you wanted a function where you loop through your array twice, that would have done it. Bravo. Shawn: I don't see another way. You go through the array converting string to time (seconds), sort, and then convert back. You have to go through the array more than once. Cheers, tedd The other way, is the most likely ultra-fast solution I posted. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Fri, May 15, 2009 at 03:12:06PM -0400, HallMarc Websites wrote: Um... sorry to jump in as a late arrival yet there you go What limitations? You could provide a layered layout using CSS and png graphic format. As for setting up columns check out float and clear and you're all set. TABLE, TR, TD, TBODY, etc were never intended to be used in the manner we see today. If you are blind and you hit a site with a mess of nested tables then.. well you might leave because of the garbage you have to listen to when the page loads. Speaking of which, correct me if I am wrong and my info is out of date but TABLEs are loaded one at a time by browsers and cause longer load times than necessary. Tables do take longer to load. The browser has to do a lot of math to determine how wide to make cells, etc. I don't know how this compares with CSS divs and such, speed wise. All in CSS is the way to go. CSS3 will make our lives easier and will contain so many new features that it will be released in batches (modules) No doubt. But if history is any guide, it will be quite some time before browsers support a new standard. In fact, browsers typically fail to support existing standards fully. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read the last line in a file?
Tom Worster wrote: imagine writing a script to run as a daemon reading data off the bottom of a log file that gets updated every few minutes and processing each new log line as they arrive. i could exec(tail $logfile, $lines, $status) every now and then. or poll the file mtime and run exec(tail $logfile, $lines, $status) when it changes. there will be some lag due to the polling interval. but it would be nice to not have to poll the file and somehow trigger the processing of the new line when the log file is written. but i'm not sure how to do that. any ideas? 1) the inotify interface will alert you when a file or directory changes. 2) run tail -f logfile | yourscript and read from stdin. (not tested). 3) if you can change the logfile to a fifo, you're all set. /Per -- Per Jessen, Zürich (11.7°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Software to read/write Excel to CD?
On Fri, 2009-05-15 at 13:55 -0400, Bob McConnell wrote: From: Bastien Koert On Fri, May 15, 2009 at 12:35 PM, Michael A. Peters mpet...@mac.com wrote: Paul M Foster wrote: On Fri, May 15, 2009 at 10:21:22AM +0100, Peter Ford wrote: Matt Graham wrote: But why write an Excel spreadsheet - why not save the data in something more portable like CSV that ExCel and read and write to once you are back at base? CSV doesn't export *formulas*, just the visible numbers. gnumeric handles everything excel that I have ever needed, and is FOSS. I believe OpenOffice also does very well. That being said, you are more likely to find excel installed than either of those, excel is the spreadsheet standard at this point, and both those products mentioned handle most excel files, so saving as excel should (in most cases) be plenty portable. unless you run into xlsx format office 2007... From what I have heard so far, OOo.org is better at reading and writing xlsx than Office 2007 SP2 is with ODF. Early reviews suggest that Microsoft has shot themselves in the foot, again. But what does this have to do with PHP? Bob McConnell There are dozens of distros out there that are offered as portable app solutions. You can run an entire OS from the USB key, and have the open-source software on there that you need, like Fx (to use Firefox's proper abbreviation), OOo, Gimp, etc. That way, it won't matter what the end user has installed on their computer, as you have everything you need right there. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Sat, 2009-05-16 at 02:25 -0400, Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster I think the argument of tables vs css can go a little deeper too. These days, sites should not only be developed with good clean code that validates, but semantic markup. If your client doesn't like/know what this is, just give it to them in terms of seo! Tabular data should be kept in tables, layout shouldn't be done with tables if you can avoid it, but if you must use them, at least check the site after in a text browser or screen reader to get an impression of how others 'see' it. Same goes for other aspects of a site too. So many times I've seen people (DreamWeaver users for the most part) litter an entire page with span tags, most of which do nothing more than bolden or italicise text, which is not all that semantic. Codes lists are another one too. That code should be in a list, as it makes more sense semantically. Trust me, semantics are gonna be the next big thing, especially if browsers start to delve into what M$ has dubbed 'slices' in IE8. Sites are forever sharing content and scraping small content areas from other sites, so wouldn't it be good to make it easier in some respects and give a bit more context and meaning to content? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote I've been using div's with in css float and only setting width of elements, that way your div grow dynamically pending on data size. it takes some time figuring it out but you should be able to find examples on the net. Bas I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shopping Cart
Hi, I am pretty new to PHP and I am trying to create a shopping cart. I keep on getting the below error when trying to show the shopping list. Any guidance that can be provided will be very much appreciated Fatal error: Call to a member function query() on a non-object in C:\wamp\www\draft\basket.php on line 36 mysql_connect.php ?php $con = mysql_connect(localhost,root,); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db(rum, $con); ? basket.php ?php include(mysql.class.php); include (header.php); include (mysql_connect.php); include (functions.php); ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=rumlist h2Rum on Offer/h2 ?php $sql= 'SELECT * FROM spirits BY id'; $result = $con-query($sql); $output[]= 'ul'; while ($row = $result-fetch()) { $output[] = 'li'.$row['name'].': pound;'.$row['price'].'br/a href=cart.php?action=addid= '.$row['id'].'Add to Cart/a/li'; } $output[] = '/ul'; echo join ('', $output); ? /div /div ?php include(footer.html); ? cart.php ?php include (header.php); include (mysql_connect.php); include (functions.php); $cart = $_SESSION['cart']; if(isset($_GET[action])) { $action = $_GET[action]; } else { $action = ; } switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=contents h2Please Check Quantities.../h2 ?php echo showCart(); ? pa href=basket.phpBack to Rum List/a/p /div /div ?php include(footer.html); ? functions.php ?php function writeCart() { $cart = $_SESSION['cart']; if (!$cart) { return 'pThere is no alcohol in your Rum Basket/p'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) 1) ? 's':''; return 'pThere area href=cart.php'.count($items).' item'.$s.' in your rum basket/a/p'; } } function showCart() { $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = 'form action=cart.php?action=update method=post id=cart'; $output[] = 'table'; foreach ($contents as $id=$qty) { $sql = 'SELECT * FROM spirits WHERE id = '.$id; $result = $con-query($sql); $row = $result-fetch(); extract($row); $output[] = 'tr'; $output[] = 'tda href=cart.php?action=deleteid='.$id.' class=rRemove/a/td'; $output[] = 'td'.$name.'/td'; $output[] = 'tdpound;'.$price.'/td'; $output[] = 'tdinput type=text name=qty'.$id.' value='.$qty.' size=3 maxlength=3 /td'; $output[] = 'tdpound;'.($price * $qty).'/td'; $total += $price * $qty; $output[] = '/tr'; } $output[] = '/table'; $output[] = 'pGrand total: pound;'.$total.'/p'; $output[] = 'divbutton type=submitUpdate cart/button/div'; $output[] = '/form'; } else { $output[] = 'pYou shopping cart is empty./p'; } return join('',$output); } ? Many Thanks Vee
Re: [PHP] Shopping Cart
On Sat, 2009-05-16 at 10:37 +0100, Vernon St Croix wrote: Hi, I am pretty new to PHP and I am trying to create a shopping cart. I keep on getting the below error when trying to show the shopping list. Any guidance that can be provided will be very much appreciated Fatal error: Call to a member function query() on a non-object in C:\wamp\www\draft\basket.php on line 36 basket.php ?php include(mysql.class.php); include (header.php); include (mysql_connect.php); include (functions.php); ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=rumlist h2Rum on Offer/h2 ?php $sql= 'SELECT * FROM spirits BY id'; $result = $con-query($sql); $output[]= 'ul'; while ($row = $result-fetch()) { $output[] = 'li'.$row['name'].': pound;'.$row['price'].'br/a href=cart.php?action=addid= '.$row['id'].'Add to Cart/a/li'; } $output[] = '/ul'; echo join ('', $output); ? /div /div ?php include(footer.html); ? [snip][/snip] Many Thanks Vee The code you are having the error on is expecting a mysqli object, but you are using mysql, which doesn't create objects that you access methods and properties of. Change the $result line in basket.php to $result = mysql_query($sql) and in your while loop change it to use $row = mysql_fetch_array($result) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Sat, 2009-05-16 at 10:48 +0100, Ashley Sheridan wrote: On Sat, 2009-05-16 at 02:25 -0400, Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster I think the argument of tables vs css can go a little deeper too. These days, sites should not only be developed with good clean code that validates, but semantic markup. If your client doesn't like/know what this is, just give it to them in terms of seo! FWIW, everything I've read indicates that tables don't affect SEO. Cheers, Rob. -- 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
[PHP] Re: CSS tables
On 15/05/2009 19.25, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? A table, meaning ONE table for tough layouts could solve many problems, specially for newbies, but tbh there are enough resources to do pretty much whatever you need to do with css if the layout doesn't have absurd constraints. Most of the IE bugs are due to floating and clearing, once you have learned to master overflow: auto and display: inline, you're good to go. Just don't get insane about trying to achieve pixel perfect in netscape4. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing of forms
I noticed that php's way to fill $_GET and $_POST is particularly inefficient when it comes to handling multiple inputs with the same name. This basically mean that every select multiple in order to function properly needs to have a name ending in '[]'. Wouldn't it be easier to also make it so that any element that has more than one value gets added to the GET/POST array as an array of strings instead of a string with the last value? I can see the comfort of having the brackets system to create groups of inputs easily recognizable as such, while I can overlook the impossibility of having an input literally named 'foobar[]', having to add [] everytime there is a slight chance of two inputs with the same name. This sounds flawed to me, as I could easily append '[]' to every input name and have a huge range of possibilities unlocked by that. This can't be right. Or can it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing of forms
I noticed that php's way to fill $_GET and $_POST is particularly inefficient when it comes to handling multiple inputs with the same name. This basically mean that every select multiple in order to function properly needs to have a name ending in '[]'. Wouldn't it be easier to also make it so that any element that has more than one value gets added to the GET/POST array as an array of strings instead of a string with the last value? I can see the comfort of having the brackets system to create groups of inputs easily recognizable as such, while I can overlook the impossibility of having an input literally named 'foobar[]', having to add [] everytime there is a slight chance of two inputs with the same name. This sounds flawed to me, as I could easily append '[]' to every input name and have a huge range of possibilities unlocked by that. This can't be right. Or can it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fileinfo and MSWord bug
PHP 5.2.6 file-4.17-15.el5_3.1 Fileinfo installed through PECL Checking certain MSWord files, I'm getting back (sans quotes) application/msword application/msword. Someone reported (in the manual comments) this same thing back in 2007: http://ca2.php.net/manual/en/ref.fileinfo.php#79063 Can anyone shed any light on how/why this is happening? Specifically, is this a bug in Fileinfo, file (the app), the Word doc, or the magic file itself? I'd love to investigate this further but am having some trouble searching online. Narrowing it down to a specific target would be most helpful. I don't see anything about it at bugs.php.net and I'd rather try to figure out if the problem is PHP-related before filing a bug. For now, I'm doing the following: $fi = new finfo(FILEINFO_MIME, FINFO_PATH); $type = $fi-file($file['tmp_name']); $split = explode(' ', $type); $type = $split[0]; Pretty hackish. If anyone has a better solution in the meantime, I'd be most appreciative. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read the last line in a file?
On 5/16/09 3:55 AM, Per Jessen p...@computer.org wrote: Tom Worster wrote: imagine writing a script to run as a daemon reading data off the bottom of a log file that gets updated every few minutes and processing each new log line as they arrive. i could exec(tail $logfile, $lines, $status) every now and then. or poll the file mtime and run exec(tail $logfile, $lines, $status) when it changes. there will be some lag due to the polling interval. but it would be nice to not have to poll the file and somehow trigger the processing of the new line when the log file is written. but i'm not sure how to do that. any ideas? 1) the inotify interface will alert you when a file or directory changes. do you mean the pecl inotify extension? that would eliminate the polling and the associated lag. but the php manual says it requires linux. if that's the case then it's not going to work for me. the app i'm working with runs on os x. os x 10.5 has FSEvents but i'm not sure that's much improvement on polling the log file. 2) run tail -f logfile | yourscript and read from stdin. (not tested). i thought of this but i couldn't see much difference between reading from stdin and opening the log file itself and reading from that (reading and tesing for eof periodically in both cases i suppose). but i may be missing something in your suggestion. 3) if you can change the logfile to a fifo, you're all set. i don't have any control over the app that writes the log file. if there were a utility like tail -f that opens a fifo for output rather than outputting to sdtout... thanks for the suggestions, per! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Cart
On Sat, May 16, 2009 at 05:37, Vernon St Croix vstcr...@hotmail.com wrote: Hi, I am pretty new to PHP and I am trying to create a shopping cart. Just as a side note: in the future, please do not cross-post on multiple lists. For general questions, this is the right place. The PHP-DB list is just for database-centric code. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shopping Cart
Darrel St Croix wrote: Thanks for that. I have changed the code as you suggested, but there is an error on the while loop. *Warning*: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in *C:\wamp\www\draft\basket.php* on line *46* That's because $result is not valid because the query failed. You'd see this if you turned on error reporting. BY is not valid in your query, maybe ORDER BY? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. CSS 2.1 makes layout easy ans IE8 passes ACID2. I have some javascript that detects the browser and warns users of IE 8 that they need to upgrade. Maybe bleeding edge for commercial sites, but helping the user upgrade is going them a favour. Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Sat, 2009-05-16 at 19:48 -0400, Stephen wrote: PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. CSS 2.1 makes layout easy ans IE8 passes ACID2. I have some javascript that detects the browser and warns users of IE 8 that they need to upgrade. Maybe bleeding edge for commercial sites, but helping the user upgrade is going them a favour. Stephen Tell that to government... many, and in some departments most, are still using IE6. I'm quite sure they won't appreciate me telling them it's time to upgrade. On the plus side though, MediaWiki is breaking ground :) Cheers, Rob. -- 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] CSS tables
On Sat, 2009-05-16 at 09:15 -0400, Robert Cummings wrote: On Sat, 2009-05-16 at 10:48 +0100, Ashley Sheridan wrote: On Sat, 2009-05-16 at 02:25 -0400, Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster I think the argument of tables vs css can go a little deeper too. These days, sites should not only be developed with good clean code that validates, but semantic markup. If your client doesn't like/know what this is, just give it to them in terms of seo! FWIW, everything I've read indicates that tables don't affect SEO. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP SEO is not the be and end all. Accessibility is a legal thing in many countries; UK and Australia especially (they are the two most prominent I know) so there's no excuse for shoddy coding. I'm not saying that using tables inevitably leads to that, but more often than not, tables are used in such a way that the reading of a page is wrong because the elements appear in the code in the wrong order, even though they visually appear correct. It's not the responsibility of the speech/Braille browsers to interpret code designed for a seeing user. They should only have to interpret semantics. Rob; sorry, this isn't a pop at you, I just wanted to explain to anyone who got hooked too much onto the SEO line you mentioned. I agree with you in that respect though, I've never seen any evidence for tables having any impact on SEO, and I've done a lot of SEO research! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Sun, 2009-05-17 at 01:52 +0100, Ashley Sheridan wrote: On Sat, 2009-05-16 at 09:15 -0400, Robert Cummings wrote: On Sat, 2009-05-16 at 10:48 +0100, Ashley Sheridan wrote: On Sat, 2009-05-16 at 02:25 -0400, Paul M Foster wrote: On Fri, May 15, 2009 at 01:25:42PM -0400, PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. I've managed to do some pages with CSS, but I feel like I am shooting myself in the foot or somewhere... Perhaps I am too demanding. I know that with tables, the formatting is ridiculously fast. Any thoughts, observations or recommendations? I think it's pretty telling that on a list of professionals who create websites constantly, the overwhelming concensus is that for forms, tables are the preferred solution. I liken this sort of discussion to the dichotomy between movie critics and people who actually go and see movies. The critics inevitably have all sorts of snobby things to say about the movies which are best attended. I'm not sure why anyone listens to any critic on any subject. Paul -- Paul M. Foster I think the argument of tables vs css can go a little deeper too. These days, sites should not only be developed with good clean code that validates, but semantic markup. If your client doesn't like/know what this is, just give it to them in terms of seo! FWIW, everything I've read indicates that tables don't affect SEO. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP SEO is not the be and end all. Accessibility is a legal thing in many countries; UK and Australia especially (they are the two most prominent I know) so there's no excuse for shoddy coding. I'm not saying that using tables inevitably leads to that, but more often than not, tables are used in such a way that the reading of a page is wrong because the elements appear in the code in the wrong order, even though they visually appear correct. It's not the responsibility of the speech/Braille browsers to interpret code designed for a seeing user. They should only have to interpret semantics. Rob; sorry, this isn't a pop at you, I just wanted to explain to anyone who got hooked too much onto the SEO line you mentioned. I agree with you in that respect though, I've never seen any evidence for tables having any impact on SEO, and I've done a lot of SEO research! You know, I'm not advocating tables in general, I'm just saying there are edge cases, that I certainly don't have the resources to flesh out into pure table-less designs. In general I advocate clean validating markup, with proper use of semantic tagging. I am very aware of accessibility guidelines, and have had to follow the Canadian Government's CLF2 guidelines often enough. However, the W3C guidelines say not to use tables when appropriate CSS exist, unfortunately the appropriate CSS is not widespread enough in some environments due to a certain monopolostic company dragging it's feet. As such, the W3C makes allowances for tables but tempers that with the expectation that they linearize properly so that accessibility is still retained. In my use of tables for the occasional layout, actually my MUD website was the first time in a long time, I did ensure that linearization was maintained. This being a hobby site, I'm sure many wouldn't even care :) Cheers, Rob. -- 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] CSS tables
Robert Cummings wrote: On Sat, 2009-05-16 at 19:48 -0400, Stephen wrote: PJ wrote: I know of no better place to ask. This may not be strictly a PHP issue, but... I am busting my hump trying to format rather large input pages with CSS and trying to avoid tables; but it looks to me like I am wasting my time as positioning with CSS seems an impossibly tortuous exercise. CSS 2.1 makes layout easy ans IE8 passes ACID2. I have some javascript that detects the browser and warns users of IE 8 that they need to upgrade. Maybe bleeding edge for commercial sites, but helping the user upgrade is going them a favour. Stephen Tell that to government... many, and in some departments most, are still using IE6. I'm quite sure they won't appreciate me telling them it's time to upgrade. On the plus side though, MediaWiki is breaking ground :) Cheers, Rob. My sites are still viewable, and can be navigated. They just look strange. Government workers are used to strange :) Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
Stephen wrote: My sites are still viewable, and can be navigated. They just look strange. Government workers are used to strange :) Stephen My experience is that government web sites are often the worst, frequently designed in MS word using brutally illegal html that only works in IE. They have fixed most of it, but one awful example was certain parts of the Shasta County website - MS word produced an html document involving really weird namespaces (illegal in html) that looked OK in IE - but in any other browser, you were presented with images of the text - images that then were scaled so you couldn't even read the text was written unless you clicked on an image and chose view image to see the image at it's native resolution. That's why government sites need regulation about web design. Often they would rather let their secretary do the site in word than use some of their budget to hire someone who actually knows what they are doing. Laws that force them to meet certain standards forces them to hire someone who knows what they are doing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
On Sat, May 16, 2009 at 08:12:29PM -0700, Michael A. Peters wrote: Stephen wrote: My sites are still viewable, and can be navigated. They just look strange. Government workers are used to strange :) Stephen My experience is that government web sites are often the worst, frequently designed in MS word using brutally illegal html that only works in IE. They have fixed most of it, but one awful example was certain parts of the Shasta County website - MS word produced an html document involving really weird namespaces (illegal in html) that looked OK in IE - but in any other browser, you were presented with images of the text - images that then were scaled so you couldn't even read the text was written unless you clicked on an image and chose view image to see the image at it's native resolution. That's why government sites need regulation about web design. Often they would rather let their secretary do the site in word than use some of their budget to hire someone who actually knows what they are doing. Laws that force them to meet certain standards forces them to hire someone who knows what they are doing. Are you the same guy who was lobbying for the licensing of PHP/HTML programmers? Argh. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
Paul M Foster wrote: On Sat, May 16, 2009 at 08:12:29PM -0700, Michael A. Peters wrote: Stephen wrote: My sites are still viewable, and can be navigated. They just look strange. Government workers are used to strange :) Stephen My experience is that government web sites are often the worst, frequently designed in MS word using brutally illegal html that only works in IE. They have fixed most of it, but one awful example was certain parts of the Shasta County website - MS word produced an html document involving really weird namespaces (illegal in html) that looked OK in IE - but in any other browser, you were presented with images of the text - images that then were scaled so you couldn't even read the text was written unless you clicked on an image and chose view image to see the image at it's native resolution. That's why government sites need regulation about web design. Often they would rather let their secretary do the site in word than use some of their budget to hire someone who actually knows what they are doing. Laws that force them to meet certain standards forces them to hire someone who knows what they are doing. Are you the same guy who was lobbying for the licensing of PHP/HTML programmers? Argh. No - not me. I do like w3c compliant code in most cases (I could care less if, say, a custom attribute that means nothing to display is used w/o defining a custom DTD), but I don't want any kind of licensing program. Such a program even if it had good intentions would be impossible to enforce given the international nature of the web. I do however feel that government sites need to work in any reasonably modern browser. Commercial sites - those with poor design will often ultimately lose business. Government sites though provide information that I as a citizen and tax payer have a right to access regardless of what operating system and browser I use. The information needs to accessible whether I'm using the latest browser or lynx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php