Re: Parse Error... how to fix?
| From: | GH | Date: | Thu, 16 Dec 2004 18:32:52 +0000 |
| Subject: | Re: Parse Error... how to fix? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204523@lists.php.net to get a copy of this message | ||
I will try this when i get back to my other computer where development
takes place.... the script format was originally started by an IDE
that I am starting to add my code to ... so I will look at.
On Thu, 16 Dec 2004 18:19:43 -0000, Ford, Mike <M.Ford@leedsmet.ac.uk> wrote:
> To view the terms under which this email is distributed, please go to
> http://disclaimer.leedsmet.ac.uk/email.htm
>
>
> On 16 December 2004 17:39, GH wrote:
>
> > Hi All...
> > Got a problem... here is the error: Parse error: parse error,
> > expecting
T_STRING' or T_VARIABLE' or
> > `T_NUM_STRING' in
> > /var/www/html/ahrc_computerclub/ahrc_computerclub.php on line 42... I
> > am not sure on how to fix it...
> >
> > line 42 is: "<TITLE> $language['program_name']
> > </TITLE>\n" .
>
> "<TITLE> {$language['program_name']} </TITLE>\n" .
>
> But:
>
> >
> > function printHeader(){
> > echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
> > Transitional//EN\"\n"
> .
> >
> > "\"http://www.w3.org/TR/REC-html40/loose.dtd\"><HTML>\n"
> > .
> > "<HEAD>\n" .
> > "<meta name=\"description\" content=\"\" >\n" .
> > "<meta name=\"author\" content=\"Gary H\">\n" .
> > "<meta name=\"keywords\" content=\"\" >\n" .
> > "<meta http-equiv=\"Content-Type\" content=\"text/html;
> charset=iso-8859-1\">\n" .
> > "<TITLE> $language['program_name'] </TITLE>\n" .
> > "</HEAD>\n".
> > "<BODY>\n";
>
> This is messy and somewhat unreadable. I would suggest either a heredoc:
>
> function printHeader(){
> echo <<<HEAD
> <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN
> http://www.w3.org/TR/REC-html40/loose.dtd\">
> <HTML>
> <HEAD>
> <meta name="description" content="" >
> <meta name="author" content="Gary H">
> <meta name="keywords" content="" >
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> <TITLE> {$language['program_name']} </TITLE>
> </HEAD>
> <BODY>
> HEAD;
> }
>
> or escaping from PHP into raw HTML:
>
> function printHeader(){
> ?>
> <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN
> http://www.w3.org/TR/REC-html40/loose.dtd\">
> <HTML>
> <HEAD>
> <meta name="description" content="" >
> <meta name="author" content="Gary H">
> <meta name="keywords" content="" >
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> <TITLE> <?php echo $language['program_name'] ?> </TITLE>
> </HEAD>
> <BODY>
> <?php
> }
>