I have a php code to which I want to include another php file which will be my "TITLE" script. My title is made up of GIFS I want to be able to define a variable externally to my main php file (e.g. main.php?type=X) and have title.php react to that change and post a GIF according to the value given. Say... if the $type variable equals X I want title.php to output X.gif and if it's Y I want title.php to output Y.gif. I know how to INCLUDE so basically I just need code for the title.php file. Can someone please help me?
if I understood you correctly, put this one into title.php and see what is it doing:
<?
echo '<img src="'.$type.gif.'">';
?>
I would do something like
<?PHP function decide_title($type) { switch($type) { case "X": $title = "y title"; break; case "Y": $title = "y title"; break; default: $title = "error"; break; } return $title; } ?>
well something like that..
Originally posted by swon if I understood you correctly, put this one into title.php and see what is it doing: <? echo '<img src="'.$type.gif.'">'; ?>
Shouldnt that be
<? echo "<img src=\"".$type.".gif\">"; ?>
oops!
I meant:
<? echo '<img src="'.$type.'.jpg">'; ?>