| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#21
| |||
| |||
| On Thu, Jan 18, 2001 at 03:14:44PM -0800, Shawn Blaylock wrote: > It's my understanding that whitespace is ignored. I could be wrong here, > though. Whitespace plays a very importend role. Between the opening tag and after a whitespace should follow valid PHP or XML code. There is one exception: <?phpinfo()?> -Egon -- http://www.linuxtag.de/ http://php.net/books.php http://www.concert-band.de/ mailto:linuxtag-subscribe@php-homepage.de |
|
#22
| |||
| |||
| At 10:50 AM 1/19/12 +0200, Teodor Cimpoesu wrote: >I was refering to whole story of using `<?' in xml docs. > >-- teodor The "<?"...">" construct comes from SGML/XML - it is called a "Processing Instruction"(PI). It's general purpose is to allow application to leave pieces of information in the XML that aren't strictly part of the content but allow it to help process it. Classic use of it to put in page formatting information into content ( pagebreaks, page no's etc ) that is only relevant to the paper production system. Part of the problems is that multiple different applications can use PI's, so they need to be able to tell which ones are their's - therefore the first thing that should go in a PI is some kind of indication as to which application requires it. Therefore: Always "<?php" is a much better idea than "<?" Regs Brian White ------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy http://www.steptwo.com.au/ bwhite@steptwo.com.au |
|
#23
| |||
| |||
| If I am not mistaken XML tags needs to be identifed. So <? doesn't mean much in XML... I like both sintaxes and in my company we only use <? ?>... Maybe we could vote the use or not of this feature? Rom ----- Original Message ----- From: Brian White <bwhite@steptwo.com.au> To: <teo@digiro.net>; <php-general@lists.php.net> Sent: Sunday, January 21, 2001 5:03 PM Subject: [php] XML Processing Instruction ( was " <? PHP vs. <?" ) At 10:50 AM 1/19/12 +0200, Teodor Cimpoesu wrote: >I was refering to whole story of using `<?' in xml docs. > >-- teodor The "<?"...">" construct comes from SGML/XML - it is called a "Processing Instruction"(PI). It's general purpose is to allow application to leave pieces of information in the XML that aren't strictly part of the content but allow it to help process it. Classic use of it to put in page formatting information into content ( pagebreaks, page no's etc ) that is only relevant to the paper production system. Part of the problems is that multiple different applications can use PI's, so they need to be able to tell which ones are their's - therefore the first thing that should go in a PI is some kind of indication as to which application requires it. Therefore: Always "<?php" is a much better idea than "<?" Regs Brian White ------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy http://www.steptwo.com.au/ bwhite@steptwo.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net |
|
#24
| |||
| |||
| I forgot to mention that if is PHP the parser (since you are creating PHP scripts in a server that use PHP as CGI or as a module) this could not be treated by the parser? I mean, the common XML tag is <?xml version... Couldn't this be solved in the server side? ----- Original Message ----- From: Brian White <bwhite@steptwo.com.au> To: <teo@digiro.net>; <php-general@lists.php.net> Sent: Sunday, January 21, 2001 5:03 PM Subject: [php] XML Processing Instruction ( was " <? PHP vs. <?" ) At 10:50 AM 1/19/12 +0200, Teodor Cimpoesu wrote: >I was refering to whole story of using `<?' in xml docs. > >-- teodor The "<?"...">" construct comes from SGML/XML - it is called a "Processing Instruction"(PI). It's general purpose is to allow application to leave pieces of information in the XML that aren't strictly part of the content but allow it to help process it. Classic use of it to put in page formatting information into content ( pagebreaks, page no's etc ) that is only relevant to the paper production system. Part of the problems is that multiple different applications can use PI's, so they need to be able to tell which ones are their's - therefore the first thing that should go in a PI is some kind of indication as to which application requires it. Therefore: Always "<?php" is a much better idea than "<?" Regs Brian White ------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy http://www.steptwo.com.au/ bwhite@steptwo.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net |
|
#25
| |||
| |||
| Brian White wrote: > > At 10:50 AM 1/19/12 +0200, Teodor Cimpoesu wrote: > > >I was refering to whole story of using `<?' in xml docs. > > Part of the problems is that multiple different applications > can use PI's, so they need to be able to tell which ones are > their's - therefore the first thing that should go in a PI > is some kind of indication as to which application requires > it. > > Therefore: Always "<?php" is a much better idea than "<?" > my follow-up was from an suggest of using <% though ![]() it exists in C, ASP and JSP. We have it in PHP, why not use it? besides moving a site arround into a configuration you cannot control I see no other reason. -- teodor |
|
#26
| |||
| |||
| Teodor Cimpoesu wrote: > my follow-up was from an suggest of using <% though ![]() > it exists in C, ASP and JSP. We have it in PHP, why not use it? Because it is not compatible with XML syntax. Following is incorrect in XML, because '<' has very restricted usage: <tag> <% echo Date("d.m.Y") %> </tag> If you use <?php instead, it is perfect XML and you can use any XML editor or other tool to work with document: <tag> <?php echo Date("d.m.Y") ?> </tag> ----------------------------------------------------------------- Jirka Kosek e-mail: jirka@kosek.cz http://www.kosek.cz |
|
#27
| |||
| |||
| At 05:24 PM 1/23/01 +0100, Jirka Kosek wrote: >Teodor Cimpoesu wrote: > > my follow-up was from an suggest of using <% though ![]() > > it exists in C, ASP and JSP. We have it in PHP, why not use it? > >Because it is not compatible with XML syntax. I agree. The short answer is to the question is "Standards". There are heaps of tools around for processing data that conforms to the XML standard - if you keep you documents ( and code script is just a document ) in XML those tools are available to you. This is one of the big arguments in favour of XSLT - because it is stored in XML the argument is that you can manage you XML content documents and the XSLT code you process it with all with the same set of tools. This includes editors, document storage, validators, pretty printers etc. ( Note: whether the benefits outweigh the cost in my example are arguable and I am not going there ) ------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy http://www.steptwo.com.au/ bwhite@steptwo.com.au |
|
#28
| |||
| |||
| Hi, I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I strip the embedded single quotes) with a minimum of overhead? (In case you'r wondering: I created the quoted string to store it in MySQL, now I want to display the same string in a Webpage. Usually the strings I display do not have embedded single quotes, and I add the single quotes when I output the string printf("<input type='text' value='%s'>", $value); That works well enough for strings that don't already have embedded quotes. But when they do I want to get rid of them quickly and easily, otherwise I get ...value = ''some value''> and Netscape doesn't display the value embedded in two single quote characters). TIA, Elan |
|
#29
| |||
| |||
| In article <3AB122F3.1F28CA27@techscribe.com>, rebol@techscribe.com (Elan) wrote: > I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I > strip the embedded single quotes) with a minimum of overhead? If there's no chance that the string could also contain legit single-quotes (such as as an apoostrophe), you can simply use str_replace(). Otherwise, either str_replace() with strpos() -- to search/replace only on 2nd char and 2nd-to-last character -- or good ol' preg_replace() by itself. -- CC |
|
#30
| |||
| |||
| use the following code $vals=explode("'", "'abc'"); $your_value=$vals[0]; //I am little confused, if it is not working try index1 Elan wrote: > Hi, > > I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I > strip the embedded single quotes) with a minimum of overhead? > > (In case you'r wondering: I created the quoted string to store it in > MySQL, now I want to display the same string in a Webpage. Usually the > strings I display do not have embedded single quotes, and I add the > single quotes when I output the string printf("<input type='text' > value='%s'>", $value); That works well enough for strings that don't > already have embedded quotes. But when they do I want to get rid of them > quickly and easily, otherwise I get ...value = ''some value''> and > Netscape doesn't display the value embedded in two single quote > characters). > > TIA, > > Elan > |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.