Forums

PHP nesting problem (4 posts)

  1. bsd13
    Member
    Posted 3 years ago #

    I hope this is the right section. I'm trying to do

    <?php
      if(is_page()); {
    <h1><?php the_title(); ?></h1>
    }  else {
    <h1>Text HERE</h1>
    }

    But it keeps giving me an "unexpected < at..." error. What am I doing wrong?

    Thanks!

  2. tugbucket
    Member
    Posted 3 years ago #

    <?php if(is_page()); { ?>
    <h1><?php the_title(); ?></h1>
    <?php } else { ?>
    <h1>Text HERE</h1>
    <?php } ?>

  3. bsd13
    Member
    Posted 3 years ago #

    Thanks for replying but didn't work. Now I'm getting "Parse error: syntax error, unexpected T_ELSE" I can make the is_page(); function just fine, but as soon as I go beyond that I run into errors.

  4. davesgonebananas
    Member
    Posted 3 years ago #

    if(is_page()); {

    remove the ;

Topic Closed

This topic has been closed to new replies.

About this Topic