Thor
Honorary Master
- Joined
- Jun 5, 2014
- Messages
- 44,236
Hey hey,
Can someone show me how I need to structure this piece of code of mine to be used as an echo?
I tried escaping the double quotes, but that just ended up echoing the php as a string ie the literal text instead of allowing it to execute.
To give some background, I want to place this inside a for each loop.
Help is greatly appreciated.
Can someone show me how I need to structure this piece of code of mine to be used as an echo?
I tried escaping the double quotes, but that just ended up echoing the php as a string ie the literal text instead of allowing it to execute.
To give some background, I want to place this inside a for each loop.
PHP:
<div class="stock <?php if ($percentage >= 0) {echo 'green';} else { echo 'red';} ?>" id="stock-1">
<span class="symbol"><?php echo $company; ?></span>
<span class="change"><?php if ($percentage >= 0) {echo '+';} else { echo '';} ?><?php echo $percentage; ?>%</span>
</div>
Help is greatly appreciated.
