Re: [PHP] HTML errors
On 12/01/11 14:13, Richard Quadling wrote: On 12 January 2011 14:07, Steve Staplessstap...@mnsi.net wrote: On Wed, 2011-01-12 at 13:40 +, Richard Quadling wrote: On 12 January 2011 13:20, Steve Staplessstap...@mnsi.net wrote: Jim, Not to be a smart ass like Danial was (which was brilliantly written though), but you have your example formatted incorrectly. You are using commas instead of periods for concatenation, and it would have thrown an error trying to run your example. :) # corrected: echo lia href=\index.php?page={$category}\{$replace}/a/li; Steve Staples. Steve, The commas are not concatenation. They are separators for the echo construct. I don't know the internals well enough, but ... echo $a.$b.$c; vs echo $a, $b, $c; On the surface, the first instance has to create a temporary variable holding the results of the concatenation before passing it to the echo construct. In the second one, the string representations of each variable are added to the output buffer in order with no need to create a temp var first. So, I think for large strings, using commas should be more efficient. Richard. Well... I have been learned. I had no idea about doing it that way, I apologize to you, Jim. I guess my PHP-fu is not as strong as I had thought? Thank you Richard for pointing out this to me, I may end up using this method from now on. I have just always concatenated everything as a force of habit. Steve Staples. I was never taught by nuns. Eh? Oh I get it... (ugh!) Surely PHP-fu is taught by monks? -- Peter Ford, Developer phone: 01580 89 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom Registered in England and Wales: 2297906 Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On Tuesday, January 11, 2011 11:48:33 pm Daniel Brown wrote: On Tue, Jan 11, 2011 at 22:35, David McGlone da...@dmcentral.net wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters This is because you misspelled $categorys, where it should actually be $categories. Goes to show ya, even Deaf people aren't perfect spellers. Still like your little joke? ;-) -- Blessings David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On Tue, 2011-01-11 at 23:38 -0800, Jim Lucas wrote: On 1/11/2011 7:35 PM, David McGlone wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; Try this instead echo 'lia href=index.php?page=',$category,'',$replace,'/a/li'; Jim Lucas [snip] Jim, Not to be a smart ass like Danial was (which was brilliantly written though), but you have your example formatted incorrectly. You are using commas instead of periods for concatenation, and it would have thrown an error trying to run your example. :) # corrected: echo lia href=\index.php?page={$category}\{$replace}/a/li; Steve Staples. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On 12 January 2011 13:20, Steve Staples sstap...@mnsi.net wrote: Jim, Not to be a smart ass like Danial was (which was brilliantly written though), but you have your example formatted incorrectly. You are using commas instead of periods for concatenation, and it would have thrown an error trying to run your example. :) # corrected: echo lia href=\index.php?page={$category}\{$replace}/a/li; Steve Staples. Steve, The commas are not concatenation. They are separators for the echo construct. I don't know the internals well enough, but ... echo $a.$b.$c; vs echo $a, $b, $c; On the surface, the first instance has to create a temporary variable holding the results of the concatenation before passing it to the echo construct. In the second one, the string representations of each variable are added to the output buffer in order with no need to create a temp var first. So, I think for large strings, using commas should be more efficient. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On Wed, Jan 12, 2011 at 06:38, David McGlone da...@dmcentral.net wrote: Goes to show ya, even Deaf people aren't perfect spellers. Still like your little joke? ;-) Of course I do. Deafness has nothing to do with spelling. If it did, just imagine how ridiculously difficult it would've been to decipher anything Helen Keller ever wrote. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On Wed, Jan 12, 2011 at 12:08, David Harkness davi...@highgearmedia.com wrote: I tried this with PHP 5.3.2 on Ubuntu 10.04, but when I run any PHP script I get the following. Fatal error in php.ini line 184: Saying a thing doesn't make it so. What does this mean? Looks like you may have installed the PECL extension PHP_BSDetect. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
At 10:35 PM -0500 1/11/11, David McGlone wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters omehome/a/lilia href=index.php?page=servicesservices/a/lilia h I have tried various combinatons and different doctypes. I'm beginning to wonder if this code is allowed at all. -- Blessings David M. David: First of all, the type (strict or transitional) of DOCTYPE doesn't matter -- it only matters IF you are going to use deprecated HTML elements (transitional) or not (strict). Second, your li (i.e., list) should start with a type of list tag, such ol for ordered list -- there are several different types (i.e., ol, ul, dir, menu, dl dt dd). Third, you might try this: echo(lia href=\index.php?page=$category\$replace/a/li); The Validator might be objecting to the way you use ' instead of . HTH's Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
If you are going to use double quotes escape out. echo lia href='index.php?page=.$category.'.$replace./a/li; On Jan 12, 2011, at 2:30 PM, tedd tedd.sperl...@gmail.com wrote: At 10:35 PM -0500 1/11/11, David McGlone wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters Šomehome/a/lilia href=index.php?page=servicesservices/a/lilia hŠ I have tried various combinatons and different doctypes. I'm beginning to wonder if this code is allowed at all. -- Blessings David M. David: First of all, the type (strict or transitional) of DOCTYPE doesn't matter -- it only matters IF you are going to use deprecated HTML elements (transitional) or not (strict). Second, your li (i.e., list) should start with a type of list tag, such ol for ordered list -- there are several different types (i.e., ol, ul, dir, menu, dl dt dd). Third, you might try this: echo(lia href=\index.php?page=$category\$replace/a/li); The Validator might be objecting to the way you use ' instead of . HTH's Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML errors
Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters …omehome/a/lilia href=index.php?page=servicesservices/a/lilia h… I have tried various combinatons and different doctypes. I'm beginning to wonder if this code is allowed at all. -- Blessings David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
Hi David: Quote your attribute value in ... On Wed, Jan 12, 2011 at 2:35 PM, David McGlone da...@dmcentral.net wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters …omehome/a/lilia href=index.php?page=servicesservices/a/lilia h… I have tried various combinatons and different doctypes. I'm beginning to wonder if this code is allowed at all. -- Blessings David M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, CHEN Dong
Re: [PHP] HTML errors
On Tue, Jan 11, 2011 at 22:35, David McGlone da...@dmcentral.net wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; } Validator Error: an attribute value must be a literal unless it contains only name characters This is because you misspelled $categorys, where it should actually be $categories. In some of the most recent updates to the core, primarily by Felipe Pena, PHP will now, by default, kick out errors in validation due to misspellings and incorrect grammar. To override this, you must uncomment the following line in your system's php.ini: ;human = true This will allow the parser to understand that you're human, thus capable of mistakes. Please keep in mind, however, that it's only able to be set in php.ini. This is to keep bots and the like from hijacking shared hosts, where an INI_PERDIR setting could potentially be written to the local account by exploitation of a variety of means (including, but not limited to, XSS, file inclusion, and SQL injection techniques). While it may seem a bit of a hassle to need to take this extra step, we all agree that Felipe has done this with the best interests of the community at heart. Having seen the substitutions of 'r' for 'are' and 'u' for 'you' (among many others), he has single-handedly taken it upon himself to use PHP not only as a tool to assist in technological projects, but as a means to teach proper spelling, grammar, and even punctuation to the world (in PHP 7, semicolons will be replaced by commas, periods, and question marks, as appropriate). To learn more about his efforts, go to http://ca2.php.net/spelling-enforcement.php -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML errors
On 1/11/2011 7:35 PM, David McGlone wrote: Hi Everyone, I'm having a problem validating some links I have in a foreach. Here is my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; my PHP code: $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials'); foreach($categorys as $category){ $replace = str_replace(_, , $category); echo lia href='index.php?page=$category'$replace/a/li; Try this instead echo 'lia href=index.php?page=',$category,'',$replace,'/a/li'; Jim Lucas } Validator Error: an attribute value must be a literal unless it contains only name characters …omehome/a/lilia href=index.php?page=servicesservices/a/lilia h… I have tried various combinatons and different doctypes. I'm beginning to wonder if this code is allowed at all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php