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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dbldeegd
    New Member
    • Jul 2007
    • 6

    #1

    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..
    Code:
     line 451
     <div id="dropin" style="LEFT: 200px; VISIBILITY: hidden; WIDTH: 500px; POSITION: absolute; TOP: 100px; HEIGHT: 100px; BACKGROUND-COLOR: #ccccff">
      more...html code.....
    
                  <div align="right"><a onclick="dismissbox();return false" href="#">[Close Box] </a></div>
     </td></li>
            </tr></tbody></table></td></tr></table>
    
    </div>
    
    
    </body>
    </html>
    
    include(PMDROOT.'/includes/template_setup.php');     
    ?>
    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
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, dbldeegd. Welcome to TSDN!

    Let's have a look at your PHP code.

    Comment

    • dbldeegd
      New Member
      • Jul 2007
      • 6

      #3
      Originally posted by pbmods
      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

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #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:
        [code=php]
        $html = 'Some HTML; notice that this string isn\'t terminated yet:
        ?>
        <html code goes here.>
        <?php
        ';
        ?>
        [/code]

        Instead, try something like this:
        [code=php]
        $html = <<<HTML
        <html code goes here.>
        HTML;
        [/code]

        Or better yet:
        [code=php]
        $html = file_get_conten ts('theHtmlFile .html');
        [/code]

        Comment

        • dbldeegd
          New Member
          • Jul 2007
          • 6

          #5
          Parse error: parse error, unexpected '\''

          Originally posted by pbmods
          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:
          [code=php]
          $html = 'Some HTML; notice that this string isn\'t terminated yet:
          ?>
          <html code goes here.>
          <?php
          ';
          ?>
          [/code]

          Instead, try something like this:
          [code=php]
          $html = <<<HTML
          <html code goes here.>
          HTML;
          [/code]

          Or better yet:
          [code=php]
          $html = file_get_conten ts('theHtmlFile .html');
          [/code]
          I did not realise how busy this board is..

          I have moved the html file but still some problem with syntax of this code
          Code:
          $html=file_get_contents('user register.html');';
          include(PMDROOT.'/includes/template_setup.php');     
          ?>
          results in
          Parse error: parse error, unexpected '\''
          the include line is the output line
          Last edited by dbldeegd; Jul 26 '07, 02:00 PM. Reason: include output

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Heya, dbldeegd.

            It looks like your error is inside of template_setup. php.

            Comment

            • dbldeegd
              New Member
              • Jul 2007
              • 6

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

              Originally posted by pbmods
              Heya, dbldeegd.

              It looks like your error is inside of template_setup. php.

              Comment

              • mwasif
                Recognized Expert Contributor
                • Jul 2006
                • 802

                #8
                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]

                Comment

                • pbmods
                  Recognized Expert Expert
                  • Apr 2007
                  • 5821

                  #9
                  Originally posted by mwasif
                  You have extra '; at the end of the first line
                  Oh, hey. Look at that.

                  Don't listen to me :P

                  Comment

                  • mwasif
                    Recognized Expert Contributor
                    • Jul 2006
                    • 802

                    #10
                    Originally posted by pbmods
                    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.

                    Comment

                    • pbmods
                      Recognized Expert Expert
                      • Apr 2007
                      • 5821

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

                      Comment

                      • dbldeegd
                        New Member
                        • Jul 2007
                        • 6

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

                        [CODE=PHP]
                        371 $html=file_get_ contents('user register.html') ;
                        372 include(PMDROOT .'/includes/template_setup. php');
                        ?>


                        [/CODE]

                        the page

                        Should I be looking elsewhere for this?


                        Originally posted by pbmods
                        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

                        Comment

                        • code green
                          Recognized Expert Top Contributor
                          • Mar 2007
                          • 1726

                          #13
                          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]

                          Comment

                          • dbldeegd
                            New Member
                            • Jul 2007
                            • 6

                            #14
                            Originally posted by code green
                            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 '\" ???

                            Comment

                            • code green
                              Recognized Expert Top Contributor
                              • Mar 2007
                              • 1726

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

                              Comment

                              Working...