cowboysdude Posted May 10, 2010 Share Posted May 10, 2010 This is what I have so far.... what I'm trying to do is if a variable is marked '0' then the display is off... '1' it's on...that part is working fine... it's the part within the part that's kicking my butt..LOL Here it is: <?php If ($nticker=="0") { echo ' <div id="NewsTicker"> <div id="controller"> <div id="stop_scroll_cont"><a id="stop_scroll"><img src="http://localhost/modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div> <div id="play_scroll_cont"><a id="play_scroll"><img src="http://localhost/modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div> </div> <div id="NewsVertical"> <ul id="TickerVertical"> <li> <h3><?echo $title?></h3> <span><p><?echo $infobox?></span> </li> <li> <h3><?php echo $title1?></h3> <span><?php echo $infobox1?></span> </li> <li> <h3><?php echo $title2?></h3> <span><?php echo $infobox2?></span> </li> </ul> </div> </div>'; } ?> It's the echo infoboxes that aren't working for me.. it just echos 'echo $infobox_' which is what I'm telling it to do... Problem is I'd like it to echo the information stored in the variables not the variables themselves. Suggestions? Many Thanks! Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/ Share on other sites More sharing options...
Pikachu2000 Posted May 10, 2010 Share Posted May 10, 2010 Change any remaining short <? open tags to the long <?php tags, terminate the echo statements with semicolons and see if that doesn't take care of it. Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055621 Share on other sites More sharing options...
cowboysdude Posted May 10, 2010 Author Share Posted May 10, 2010 I appreciate the help!! But I'm not quite sure what you mean so this is what I did.. changed <? echo $infobox?> to <?php echo $infobox;?> But it shows nothing... at least it's not showing me the "echo $infobox' anymore..LOL Here is what I'm seeing in the html source... <div id="NewsVertical"> <ul id="TickerVertical"> <li> <h3><?php echo $title;?></h3> <span><p><?php echo $infobox;?></span> </li> <li> <h3><?php echo $title1;?></h3> <span><?php echo $infobox1;?></span> </li> <li> <h3><?php echo $title2;?></h3> <span><?php echo $infobox2;?></span> </li> </ul> </div> </div> Not quite sure why it won't work but hey this is how we learn... Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055626 Share on other sites More sharing options...
kenrbnsn Posted May 10, 2010 Share Posted May 10, 2010 First question: Does your host support PHP? Second question: Is the file type of your script ".php", if it's ".html" rename your file and try again. Ken Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055628 Share on other sites More sharing options...
Pikachu2000 Posted May 10, 2010 Share Posted May 10, 2010 I just spotted the likely culprit. Your echo statement is single-quoted, therefore everything in it is being interpreted as string literals. You need to restructure the echo using string concatenation, or double quotes and escaping where necessary. Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055637 Share on other sites More sharing options...
kenrbnsn Posted May 10, 2010 Share Posted May 10, 2010 I missed that because of the "echo" statements inside the string. I've always disliked echoing a bunch of HTML with just a little PHP embedded. For cases like that, I just exit out of PHP, do straight HTML and go in/out of PHP where needed: <?php If ($nticker=="0") { ?> <div id="NewsTicker"> <div id="controller"> <div id="stop_scroll_cont"><a id="stop_scroll"><img src="http://localhost/modules/mod_game/img/stop.png" width="14" height="14" border="0" align="absmiddle" /></a> Stop news scroll</div> <div id="play_scroll_cont"><a id="play_scroll"><img src="http://localhost/modules/mod_game/img/play.png" width="14" height="14" border="0" align="absmiddle"/></a> Play news scroll</div> </div> <div id="NewsVertical"> <ul id="TickerVertical"> <li> <h3><?php echo $title ?></h3> <span><p><?php echo $infobox ?></span> </li> <li> <h3><?php echo $title1 ?></h3> <span><?php echo $infobox1 ?></span> </li> <li> <h3><?php echo $title2 ?></h3> <span><?php echo $infobox2 ?></span> </li> </ul> </div> </div> <?php } ?> Ken Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055639 Share on other sites More sharing options...
cowboysdude Posted May 10, 2010 Author Share Posted May 10, 2010 Thank you!! That worked... wow... very simple and sound reasoning! Many Thanks! Link to comment https://forums.phpfreaks.com/topic/201210-im-a-little-lostlol/#findComment-1055736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.