brown2005 Posted November 12, 2008 Share Posted November 12, 2008 <div id="logo"><a href="'.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=home">Home</a>'. if( $config_website_url_topic == "home" ) { } else { echo"test"; } .'</div> it is not displaying anything. Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/ Share on other sites More sharing options...
JasonLewis Posted November 12, 2008 Share Posted November 12, 2008 Why do you have an if() statement in what looks like to be the middle of a string? Please show more code. Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688433 Share on other sites More sharing options...
redarrow Posted November 12, 2008 Share Posted November 12, 2008 //$config_website_url/$config_website_url_topic <<< what in them hopefully somethink deleted them... a stab in the dark.... <?php echo "<div id='logo'>"; echo"<a href='index.php?page=home'>Home</a>"; if($_GET['page'] == "home" ) { echo "got correct result"; }else{ echo "incorrect result"; } echo"</div>"; ?> Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688440 Share on other sites More sharing options...
redarrow Posted November 12, 2008 Share Posted November 12, 2008 What are u trying to do please. Are u trying to design a index page with url condition's Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688444 Share on other sites More sharing options...
waynew Posted November 12, 2008 Share Posted November 12, 2008 if( $config_website_url_topic == "home" ) { echo '<div id="logo"><a href="'.$config_website_url.' / '.$config_website_url_topic.'/index.php?page=home">Home</a></div>; } else { echo"test"; } Maybe you were trying to do this? Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688445 Share on other sites More sharing options...
redarrow Posted November 12, 2008 Share Posted November 12, 2008 if that what you want here it corrected ok...... <?php if( $config_website_url_topic == "home" ) { echo "<div id='logo'><a href='$config_website_url/$config_website_url_topic/index.php?page=home'>Home</a></div>"; } else { echo"test"; } ?> Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688455 Share on other sites More sharing options...
premiso Posted November 12, 2008 Share Posted November 12, 2008 <div id="logo"><a href="'.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=home">Home</a>'. if( $config_website_url_topic == "home" ) { } else { echo"test"; } .'</div> it is not displaying anything. Mainly because the syntax is all wrong. If you want the IF on oneline this should work: <?php $insert = ($config_website_url_topic == "home")?"":"test"; echo '<div id="logo"><a href="'.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=home">Home</a>'. $insert .'</div>'; ?> Link to comment https://forums.phpfreaks.com/topic/132416-how-do-i-get-this-code-to-work/#findComment-688497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.