View Full Version : If condition set a functon to ""

08-17-2012, 10:35 AM
my problem is is that When my page gets to Experience, the title Experience still shows, I would like to set Experience as "" (blank)

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

08-17-2012, 07:05 PM
This line
the_title( '<h2>', '</h2>' ) = ""; is highly suspect. Think it shoud be
echo '<h2></h2>';.

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

08-17-2012, 07:15 PM
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).

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum