Jump to content

how do i get this code to work.


brown2005

Recommended Posts

 

//$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>";

?>

 

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"; 
} 

?>


<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>';

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.