Re: [PHP] Include/require and the HTML Code

2002-08-14 Thread Sascha Braun

Maybe something wrong with the return?

I was thinking about return What?. (U understand me?)

in Javascript a simple return does nothing. maybe you can just leave the
return out of your script.



- Original Message -
From: Mike Eales [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 14, 2002 10:44 AM
Subject: [PHP] Include/require and the HTML Code


 Hi,

 Can anybody tell me why I get a Parse error: parse error,
 unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line
 17 
 for the following code:

 Appreciate any help.

 Using PHP 4.2.2 and Apache 1.3.26 on Redhat 7.3 x86

 (The  stuff is not part of the code. index.php and
 Functions.inc exists in the same dir)

  File: index.php 
 ?
 require('./Functions.inc');

 HtmlHeader();

 # Do things

 HtmlFooter();

 ?

  End of file 


  File: Functions.inc
 
 function HtmlHeader()
 {
 ?

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 htmlhead
 meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1
 titleLogBook/title
 /head

 body bgcolor=#FF text=#00 link=#FF
 vlink=#80 alink=#FF

 ?

 return;
 } --- This is line 17, the error point..


 function HtmlFooter()
 {
 ?
 /body /html

 ?

 return;
 }

  End of file 


 Thanks
 Mike.



 --
 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




Re: [PHP] Include/require and the HTML Code

2002-08-14 Thread Bas Jobsen

 Can anybody tell me why I get a Parse error: parse error,
 unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line

begin and end your include files with ? and ?
?
 function HtmlHeader()
 {
 ?
bllaalla

?
return;
}
?


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




RE: [PHP] Include/require and the HTML Code

2002-08-14 Thread Peter Houchin

Mike,

i had no problems with this..


!-- index.php --
?
 include('Functions.inc');

 HtmlHeader();
?
 # Do things
?
 HtmlFooter();

 ?


!-- Functions.inc--
?
function HtmlHeader()
 {
 ?

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 htmlhead
 meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1
 titleLogBook/title
 /head

 body bgcolor=#FF text=#00 link=#FF
vlink=#80 alink=#FF

 ?

 return;
 }
?
?
 function HtmlFooter()
 {
 ?
 /body /html

 ?

 return;
 }

cheers
Peter


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




RE: [PHP] Include/require and the HTML Code

2002-08-14 Thread Michael Eales


This did indeed fix the problem, thanks for the advise.

A question though:
Why is this necessary, the include/require is called from index.php while in
PHP mode ?
The functions work fine as if I remain in PHP mode within the functions.
It is only when I go in and out of HTML mode within the function that this
problem arises.

Thanks again
Mike.

-Original Message-
From: Bas Jobsen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 15 August 2002 6:52 AM
To: Mike Eales; [EMAIL PROTECTED]
Subject: Re: [PHP] Include/require and the HTML Code


 Can anybody tell me why I get a Parse error: parse error,
 unexpected '}' in /usr/local/apache/htdocs/logbook/Functions.inc on line

begin and end your include files with ? and ?
?
 function HtmlHeader()
 {
 ?
bllaalla

?
return;
}
?


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




Re: [PHP] Include/require and the HTML Code

2002-08-14 Thread Chris Shiflett

I'm not sure about others, but I am glad this behavior is like this.

It is very nice for modules to stand on their own so to speak, so that 
you don't have to worry about what context they are used in. If the file 
you are including is plain HTML, would you want it to be parsed as if it 
were PHP? No, but if you had to include PHP in it (the closing ? for 
example), it wouldn't be a plain HTML file anymore. You might have other 
applications in different languages using the same module that would now 
have to interpret PHP.

On the other hand, what about a PHP script that you want to include. 
Wouldn't it be annoying to get a parse error when you include it because 
of the double opening tags?

Those are just a few thoughts.

Happy hacking.

Chris

Michael Eales wrote:

This did indeed fix the problem, thanks for the advise.

A question though:
Why is this necessary, the include/require is called from index.php while in
PHP mode ?
The functions work fine as if I remain in PHP mode within the functions.
It is only when I go in and out of HTML mode within the function that this
problem arises.



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