Re: [PHP] Re: Include File Errors with Comments

2009-03-12 Thread Patrick Moloney

Andrew Ballard wrote:


I do use PHP comments (probably not as much as I should), but I don't
usually use HTML comments. This is partly (largely?) because HTML
comments get passed on to the client which wastes (albeit usually a
small amount of) extra space and bandwidth for each request, and they
give out implementation details to people who least need to know them.

Andrew


That's another issue, but a good point. I was thinking about that too, 
and I think it influenced some of my comments.

This has been my first use of PHP so I'm still learning.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Include File Errors with Comments

2009-03-12 Thread Andrew Ballard
On Wed, Mar 11, 2009 at 7:51 PM, Patrick Moloney  wrote:
> OK, I think I've got the problem. I had to go back further than where the
> problem appeared to be. The 1st error was the comment code on the div line
> before the menu is Included. It had the "--" in the comment.
> Oddly, it interacts with the same error in the comment in the mainmenu file.
> I saw some suggestion that these work in pairs but fail in odd numbers. So,
> I have many pages that work like this.
> Adding another bad comment to the mainmenu, causes it to fail (3 bad lines).
> Or, without a third line, fixing the only bad line in the mainmenu also
> fails! Now, correcting the bad line in the web page fixes that -- (whoops) -
> but causes all the other similar web site pages to start failing.
> I'll have to fix them all, but at least I know the problem.
> No wonder nobody comments code!
>
>
> mainmenu.php
>
> 
> 
> Functional Menu code
> ...
>
>
> webpage.php
> ...
> 
>  
> 
> 
> ...
>

I do use PHP comments (probably not as much as I should), but I don't
usually use HTML comments. This is partly (largely?) because HTML
comments get passed on to the client which wastes (albeit usually a
small amount of) extra space and bandwidth for each request, and they
give out implementation details to people who least need to know them.

I can sort of see adding the HTML comments when designing a full page
template so it is easier to determine where dynamic content needs to
be inserted when you start slicing the template apart, but even then I
usually remove those comments later in the design process before I put
the code out for production. Then again, I haven't included files for
anything other than function/class libraries in years either.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Include File Errors with Comments

2009-03-11 Thread Patrick Moloney
OK, I think I've got the problem. I had to go back further than where 
the problem appeared to be. The 1st error was the comment code on the 
div line before the menu is Included. It had the "--" in the comment.
Oddly, it interacts with the same error in the comment in the mainmenu 
file. I saw some suggestion that these work in pairs but fail in odd 
numbers. So, I have many pages that work like this.
Adding another bad comment to the mainmenu, causes it to fail (3 bad 
lines). Or, without a third line, fixing the only bad line in the 
mainmenu also fails! Now, correcting the bad line in the web page fixes 
that -- (whoops) - but causes all the other similar web site pages to 
start failing.

I'll have to fix them all, but at least I know the problem.
No wonder nobody comments code!


mainmenu.php



Functional Menu code
...


webpage.php
...

 


...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Include File Errors with Comments

2009-03-11 Thread Shawn McKenzie
Patrick Moloney wrote:
> Thanks for all the replies.
> As I said in my original post the comments are on the first lines of the
> included file and are HTML comments. I'll have to look closer at comment
> syntax - I see there are "empty comments" and issues with pairs of
> double hyphens.
> 
> My overall code worked well with 2 comment lines, then had issues with
> the third. I eventually removed my third comment (no problem) then
> copied my 2nd comment as the 3rd (problem returns).
> I had some double hyphens "--" which seemed to cause problems sometimes.
> I'm also thinking that it is seeing pairs of "--" that are causing
> issues in odd numbers (half-pairs) only.
> 
> I'll have to look closer.

By definition, A comment declaration starts with . A comment starts and ends with "--", and
does not contain any occurrence of "--".

This being said, depending on how you do it, some browsers will get it
wrong, so to keep it simple:

An HTML comment begins with "" and does not contain
"--" or ">" anywhere in the comment.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Include File Errors with Comments

2009-03-11 Thread Patrick Moloney

Thanks for all the replies.
As I said in my original post the comments are on the first lines of the 
included file and are HTML comments. I'll have to look closer at comment 
syntax - I see there are "empty comments" and issues with pairs of 
double hyphens.


My overall code worked well with 2 comment lines, then had issues with 
the third. I eventually removed my third comment (no problem) then 
copied my 2nd comment as the 3rd (problem returns).

I had some double hyphens "--" which seemed to cause problems sometimes.
I'm also thinking that it is seeing pairs of "--" that are causing 
issues in odd numbers (half-pairs) only.


I'll have to look closer.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php