467,910 Members | 1,561 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Parse error: Unexpected '<' (opening HTML tag marker)

My Java Script executes fine on an test HTML page, but on the required page which is php results in an error.

the page

The script drops in message box when the page is loaded
since the script works the problemshould lie elsewhere..
Expand|Select|Wrap|Line Numbers
  1.  line 451
  2.  <div id="dropin" style="LEFT: 200px; VISIBILITY: hidden; WIDTH: 500px; POSITION: absolute; TOP: 100px; HEIGHT: 100px; BACKGROUND-COLOR: #ccccff">
  3.   more...html code.....
  4.  
  5.               <div align="right"><a onclick="dismissbox();return false" href="#">[Close Box] </a></div>
  6.  </td></li>
  7.         </tr></tbody></table></td></tr></table>
  8.  
  9. </div>
  10.  
  11.  
  12. </body>
  13. </html>
  14.  
  15. include(PMDROOT.'/includes/template_setup.php');     
  16. ?>
  17.  
The error results in Parse error: parse error, unexpected '<' in line 451 which opens the div.

I cannot figure out what is missing and any suggestions would be appreciated.


thanks
Jul 24 '07 #1
  • viewed: 2299
Share:
14 Replies
pbmods
Expert 4TB
Heya, dbldeegd. Welcome to TSDN!

Let's have a look at your PHP code.
Jul 24 '07 #2
Heya, dbldeegd. Welcome to TSDN!

Let's have a look at your PHP code.

Thanks pbmods.

The code is fairly lengthy....
and includes
$custom javascript .='

(PMDROOT.'/includes/template_setup.php');
?>

the problem is where should the JS be placed??

here is what should happen.

I couls send an attachment
Jul 25 '07 #3
pbmods
Expert 4TB
Heya, dbldeegd.

Are you trying to store the HTML into a string, or do you want to output the HTML directly?

You can't leave a string unterminated and then append HTML output. In other words, this won't work:
Expand|Select|Wrap|Line Numbers
  1. $html = 'Some HTML; notice that this string isn\'t terminated yet:
  2. ?>
  3. <html code goes here.>
  4. <?php
  5. ';
  6. ?>
  7.  
Instead, try something like this:
Expand|Select|Wrap|Line Numbers
  1. $html = <<<HTML
  2. <html code goes here.>
  3. HTML;
  4.  
Or better yet:
Expand|Select|Wrap|Line Numbers
  1. $html = file_get_contents('theHtmlFile.html');
  2.  
Jul 25 '07 #4
Heya, dbldeegd.

Are you trying to store the HTML into a string, or do you want to output the HTML directly?

You can't leave a string unterminated and then append HTML output. In other words, this won't work:
Expand|Select|Wrap|Line Numbers
  1. $html = 'Some HTML; notice that this string isn\'t terminated yet:
  2. ?>
  3. <html code goes here.>
  4. <?php
  5. ';
  6. ?>
  7.  
Instead, try something like this:
Expand|Select|Wrap|Line Numbers
  1. $html = <<<HTML
  2. <html code goes here.>
  3. HTML;
  4.  
Or better yet:
Expand|Select|Wrap|Line Numbers
  1. $html = file_get_contents('theHtmlFile.html');
  2.  
I did not realise how busy this board is..

I have moved the html file but still some problem with syntax of this code
Expand|Select|Wrap|Line Numbers
  1. $html=file_get_contents('user register.html');';
  2. include(PMDROOT.'/includes/template_setup.php');     
  3. ?>
results in
Parse error: parse error, unexpected '\''
the include line is the output line
Jul 26 '07 #5
pbmods
Expert 4TB
Heya, dbldeegd.

It looks like your error is inside of template_setup.php.
Jul 26 '07 #6
My head is scrambled trying to figure this out

the output line 372 is include(PMDROOT.'/includes/template_setup.php');
the file /includes/template_setup.php just sets the output which includes several templates.

Is there a different syntax for this $html=file_get?

Heya, dbldeegd.

It looks like your error is inside of template_setup.php.
Jul 28 '07 #7
mwasif
Expert 512MB
You have extra '; at the end of the first line
[PHP]$html=file_get_contents('user register.html');';
include(PMDROOT.'/includes/template_setup.php'); [/PHP]
This should be
[PHP]$html=file_get_contents('user register.html');
include(PMDROOT.'/includes/template_setup.php'); [/PHP]
Jul 28 '07 #8
pbmods
Expert 4TB
You have extra '; at the end of the first line
Oh, hey. Look at that.

Don't listen to me :P
Jul 28 '07 #9
mwasif
Expert 512MB
Oh, hey. Look at that.

Don't listen to me :P
That's why proper code tags are important;). BTW, I always use Dreamwear for such kind of questions.
Jul 28 '07 #10
pbmods
Expert 4TB
Heya, dbldeegd.

Thanks for using CODE tags! Did you know that you can specify a language for your CODE tags to make your source code easier to read?

You will still need to use [/code] to close your code blocks, regardless of the language, but you can the use one of these tags to open your code block:

[code=html]
[code=javascript]
[code=php]

and so on.

Thanks!

MODERATOR
Jul 28 '07 #11
Thanks for all the comments
I am still struggling with this

I now receive the parse error

Parse error: parse error, unexpected '\'' in /....../members/user_registest.php on line 372

Expand|Select|Wrap|Line Numbers
  1. 371   $html=file_get_contents('user register.html');
  2. 372   include(PMDROOT.'/includes/template_setup.php');     
  3. ?>
  4.  
  5.  
  6.  
the page

Should I be looking elsewhere for this?


Heya, dbldeegd.

Thanks for using CODE tags! Did you know that you can specify a language for your CODE tags to make your source code easier to read?

You will still need to use [/code] to close your code blocks, regardless of the language, but you can the use one of these tags to open your code block:

[code=html]
[code=javascript]
[code=php]

and so on.

Thanks!

MODERATOR
Aug 2 '07 #12
code green
Expert 1GB
Parse error: parse error, unexpected '\'' in /....../members/user_registest.php on line 372
371 [PHP]$html=file_get_contents('user register.html');[/PHP] PHP doesn't like spaces in file names. But your constant could be causing the problem. [PHP]include(PMDROOT.'/includes/template_setup.php');[/PHP]
Aug 2 '07 #13
371 [PHP]$html=file_get_contents('user register.html');[/PHP] PHP doesn't like spaces in file names. But your constant could be causing the problem. [PHP]include(PMDROOT.'/includes/template_setup.php');[/PHP]
The lines have been edited:
[PHP]371 $html=file_get_contents('user_register.html');
372 include(PMDROOT.'/includes/template_setup.php');
?>
[/PHP]
but now the following error is received
Parse error: parse error, unexpected '\'' in /...../econsumersearch/members/user_registest.php on line 372

Why and what is being interpreted as '\" ???
Aug 8 '07 #14
code green
Expert 1GB
Why and what is being interpreted as '\" ???
The code you posted does not define PMDROOT. As I said in my last post, I suspect the error is in this constant
Aug 13 '07 #15

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Marten van Urk | last post: by
1 post views Thread by Janwillem Borleffs | last post: by
6 posts views Thread by Ehartwig | last post: by
4 posts views Thread by redsky | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.