Well, I guess my very first post in this forum lets me
answer a question instead of pose a new one...
altoidboy wrote:
i don't see the line you mentioned. i do however see this:
[code:1]echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';[/code:1]
which i'm not sure if it's the same thing or not.
if i view my site in a browser and then pull up the source for the generated page, i see this:
[code:1]<?xml version="1.0" encoding="iso-8859-1"?>[/code:1]
so it looks like it's sneaking in there somehow!
would you advise i comment out the entire "echo" line (above)?
The short answer is: yes, if you comment out the entire line:
[code:1]echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';[/code:1]
...it will remove the line:
[code:1]<?xml version="1.0" encoding="iso-8859-1"?>[/code:1]
...from your final page.
Now, let me try to explain what is happening, and why. Keep in mind, I am a PHP newbie (but with other scripting experience)... however, the fact that I can explain this at least tells me I know enough to help you, and that is least I can offer. Think of this as your first lesson in PHP.
Basically, the 'echo...' line of code is just telling your browser the PHP engine
how to create the final line of code.
"echo" is basically the php code for "print the rest of this sentence to the final browser-compatible page, replacing any code variables with their proper meaning, and removing any code that is inappropriate for the browser".
The parts between the single quotes (
'<?xml version="1.0" encoding="') is the first part part of the
sentence that is being
echoed. Single quotes are used because the text inside has its own quote marks. If you are trying to
echo[/] text with single quotes, it needs to be surrounded by double quotes; and if you are trying to echo[/] text with double quotes, it needs to be surrounded by single quotes. This prevents the PHP engine from being confused and accidentally echoing only part of the text.
The Dot (.) is like a plus sign... it tells the PHP code "hey, add (aka concatenate) this next bit of text to the sentence you're echoing".
Immediately following the dot (.) is a variable. That's the thing that starts with a dollar-sign ($). The variable stands for something else, which has been defined elsewhere in the system. In this case, $iso[1] = iso-8859-1.
Then, another dot, to connect the next part, between the quotes, to the sentence that is being echoed. In this case, it is the quote-mark and question mark that follows the iso-number.
Then, another dot, to connect the last part between quotes, the closed bracket.
Finally, we end our PHP statement with a semi-colon (it's like the period at the end of the sentence... it tells the PHP engine that you have finished a command).
Now, to be honest, I don't know why the '"?' and the '>' had to be concatenated by a dot, and couldn't just be put together in a single set of quotes, since there are no variables between them. I would imaging that the end could have appeared as: '"?>' instead of '"?'.'>' ... but like I said, I am a bit of a PHP newbie. If there are any pro's out there, I wouldn't mind learning if there is really a difference, or if perhaps a change in the code from a previous syntax might have just left this a bit clunkier than it should have.
I certainly hope this helps you, and any other folks who are greener than I, begin to understand why the first bit of code in the PHP side is ultimately the same thing as the 2nd but of code on the browser side.
Cheers, and good luck!
Poster Nutbag