-2

Can someone tell me what i'm doing wrong, please? The error I get when I go to my website is as follows:

Parse error: syntax error, unexpected '<' in /home/content/52/9623852/html/index.php on line 19


Here's the coding for the index.php:

<?php
/**
* The main template file.
*/

get_header(); ?>

    <div id="primary">
    <div style="border: 2px solid #333;float: left;width: 875px;margin-top: 10px;margin-left: 15px; margin-bottom:10px;background: #ccc url(<?php bloginfo('template_url');?>/images/bgcontent.jpg) repeat-y;">
        <div id="content">
        <?php if ( have_posts() ) : ?>

            <?php twentyeleven_content_nav( 'nav-above' ); ?>

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'content', get_post_format() ); ?>

            <?php endwhile; ?>

            <?php twentyeleven_content_nav( 'nav-below' ); ?>

        <?php else : ?>

            <article id="post-0" class="post no-results not-found">
                <header class="entry-header">
                    <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
                </header><!-- .entry-header -->

                <div class="entry-content">
                    <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
                    <?php get_search_form(); ?>
                </div><!-- .entry-content -->
            </article><!-- #post-0 -->

        <?php endif; ?>
        </div><!-- #content -->
        <?php get_sidebar(); ?>
        </div>
    </div><!-- #primary -->
<?php get_footer(); ?>
Havelock
  • 6,913
  • 4
  • 34
  • 42
Joey T
  • 1
  • 1
  • Maybe missing "" (quotes) in url("/images/bgcontent.jpg") – jezrael Aug 17 '15 at 19:06
  • Thanks Jezrael...I tried the qoutes...it didn't work. – Joey T Aug 17 '15 at 19:14
  • 1
    So give us a clue .... which is line 19? – RiggsFolly Aug 17 '15 at 19:17
  • 1
    It does annoy me when someone codes 8 consecutive lines of PHP and each line is wrapped in a `` Makes the code almost unreadable – RiggsFolly Aug 17 '15 at 19:19
  • Sorry guys for the not so perfect coding...I didn't personally do this coding originally...I'm just trying to fix the issue that came up for the owner of the webpage. the site was working fine saturday...but now it's been showing this error...so please have patience with me. – Joey T Aug 17 '15 at 19:22
  • Line 19 would be where it says: – Joey T Aug 17 '15 at 19:24
  • 3
    The code as posted doesn't have any parse errors. Copy/pasting the whole block to a file and linting it with `php -l` produces no parse error. Are you certain this is the exact version of the file `/home/content/52/9623852/html/index.php` which is erroring? – Michael Berkowski Aug 17 '15 at 19:43
  • Possible its something being included, not in the script itself. – Thomas Aug 17 '15 at 20:03

1 Answers1

0

The way to get to the bottom of your problem issue is to use a standard debugging procedure:

  • Either comment out or delete blocks of logic until you stop getting a syntax error, telling you that you deleted the area that the error comes from.
  • If you delete a block, but trying to run the code still reports a syntax error, undo that delete, and delete the next block of code systematically.
  • Once your parser accepts with a block deleted, try deleting different sub-blocks within that area.

You're looking at the problem with your eyes, and while that's the first line of defense, just glancing at this code isn't enough (mainly because the codebase is very dirty/somewhat undisciplined).

Let the php parser do the work for you, delete potentially offending blocks until the parser stops screaming.

Kzqai
  • 22,588
  • 25
  • 105
  • 137