Hi I don't know why the thumb1.jpg and big1.jpg are not showing up. Here's the code: $imgNo =1; <?php echo '<li><img src="images/thumb"'.$imgNo.'".jpg" alt="White" title="RapperW" border="0" onclick="swap(\'largeid\',\'images/big$imgNo.jpg\');"/></li>'; ?> Any clues?
i think you need to use " instead of ' for your string above, data inside ' doesn't get parsed, so it'd be ignoring the backslashed ' in your string because of it, using " will fixed that.
Dunno about big1.jpg but the first one, you have it outputting something like thumb"1.jpg" which is wrong of course. $imgNo =1; <?php echo '<li><img src="images/thumb'.$imgNo.'.jpg" alt="White" title="RapperW" border="0" Should fix it. That of course assumes you have $imgNo1 inside the <?php tags.
Try this: <?php echo "<li><img src=\"images/thumb/$imgNo.jpg\" alt=\"White\" title=\"RapperW\" border=\"0\" onclick=\"swap('largeid','images/big$imgNo.jpg');\"><li>"; ?> Code (markup): That should do it. Make sure that second var gets parsed though (in the onclick). You might have to change the "" '' in there I think.
Just curious, Whats the difference between single quote and double quote? I meant they both seems to work.
double quotes, php will parse double quotes, but won't parse single quotes. $var = "bob"; print "$var"; [/bob] you'll get "bob" [code] $var = "bob"; print '$var'; [/bob] will print out $var Code (markup):
<img src="images/thumb"'.$imgNo.'".jpg" ...etc. You are essentially printing <img src="images/thumb"1".jpg .....
<?php $imgNo =1; echo "<li><img src=\"images/thumb$imgNo.jpg\" alt=\"White\" title=\"RapperW\" border=\"0\" onclick=\"swap(\'largeid\',\'images/big$imgNo.jpg\');\"/></li>"; ?> I think this will help you just copy and paste it.......... :
Just concatenate it: echo '<li><img src="images/thumb"' . $imgNo . '".jpg" alt="White" title="RapperW" border="0" onclick="swap(\'largeid\',\'images/big' . $imgNo . '.jpg\');"/></li>'; PHP:
Example: $var = 'Hello'; echo "$var world!"; echo '$var world!'; /* Theoretical fastest way */ echo $var , ' world!'; ?> Run to see the difference. Parses things such as \n, \r, \t and variables etc if it's IN double quotes, otherwise not. Dan