Jump to content

I'm a little lost...LOL


cowboysdude

Recommended Posts

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!  :D

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.