Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question If condition set a functon to ""

    my problem is is that When my page gets to Experience, the title Experience still shows, I would like to set Experience as "" (blank)

    Code:
    <?php if(the_title( '<h2>', '</h2>', false ) == "Experience") {?>
    				<?php echo '<h2>Profit from our experience</h2>'; ?>
    				<?php } else if(the_title( '<h2>', '</h2>', false ) == "Experience") { ?>
    				<?php the_title( '<h2>', '</h2>' ) = ""; ?>
    				<?php } else { ?>
    				<?php the_content(); ?>
    				<?php } ?>

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,484
    Thanks
    23
    Thanked 636 Times in 635 Posts
    This line
    Code:
     the_title( '<h2>', '</h2>' ) = "";
    is highly suspect. Think it shoud be
    Code:
    echo '<h2></h2>';
    .

    Curious, why all the php tags? You could open php at the top of this code and close at the bottom.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Meh, one of the CMS's out there use <?php ... ?> for every line. I haven't a clue why.

    That's your problem above there. You simply cannot assign to a function call; you can only assign to variables. Note that your if's are not functional either since the elseif condition matches that of the if condition it will never reach the elseif (which would trigger a fatal error anyway since you cannot write to an unassigned return value).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •