hi
Ok to my understnding when you use " (double quotes) to echo out a statement in PHP, you can call functions / variable etc without having to close the echo statement as in the case of the ' (single quotes) yea?
What I want to know is that in the code below for recent topics (mod version) the arrays send values - would these need to be in '' or should they be taken out?
Currently I get an error when trying to run this code:
global $scripturl;
$what=ssi_recentTopics('10', array('13','58'), 'array');
echo "<table border='0' width='100%' cellspacing='1' cellpadding='4' class='bordercolor'>";
echo "<tr class='catbg3'><td valign='middle'>Subject</td><td valign='middle'>Board</td><td valign='middle'>Poster</td><td valign='middle'>Time</td></tr>";
foreach ($what as $topic)
{
echo "<tr><td class='windowbg' valign='middle'>$topic['link']";
// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo "<a href='$scripturl?topic=$topic['topic'].from$topic['time']#new><img src='$settings['images_url']/$context['user']['language']/new.gif alt='$txt[302]' border='0' /></a>";
echo "</td><td class='windowbg2' valign='middle' >$topic['board']['link']</td>";
echo "</td><td class='windowbg2' valign='middle' >$topic['poster']['link']</td><td class='windowbg2' valign='middle' >";
if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo "<a href='$topic['href']'><img src='$settings['images_url']/icons/last_post.gif alt='$txt[111]' title='$txt[111]' border='0' style='float: right;' /></a>";
echo "<span class='smalltext'>$topic['time']</span></td></tr>";
}
echo "</table>";
You can use either, but always remember to escape the 'opposite' quote, or simply escape them all. SMF usually uses single quotes because it's slightly faster I think.
ah I see
ok then ill try the same code above using single quoted echo statements and see how it goes :D Thanks
oh wow!
its easier too using single quotes
got it working in 3 mins!
:D thanks again
If you use single quotes you can put the variables straight into the text though, you have to do something like
echo 'text yay', $context['data'], 'more text yay';
yea thats the problem i was having with double quotes - or maybe i was doing it wrong because this was giving errors:
echo" text yay $context['data'] more text yay";
but doing the single quoted echo worked just fine - so switched over to it :)
yall want the tutorial? lmao double quotes allow the use of vars inside the echo string but accent does not you have to come out of accent put var in than go back into accent.
I'll find you that tut ;)
http://us3.php.net/manual/en/function.echo.php
and lesson 2 operators in php lol
http://us3.php.net/manual/en/language.operators.php
aahhh so I would have had to use:
echo" text yay {$context['data']} more text yay";
with the {}
cool! Thanks for the site- i didnt even know it existed :D
;) Ive listed several tool links in my board check them out sometime lol.
Questors gate here i comeeeee!
WOW!!!! Man that red dragon theme is WAY COOL!!!!
WOW! but there seems to be some error - i assume ur testing it
my games are in alpha and beta m8 but they will get there lol thanks
I always found single ones easiest - because then you don't need to escape any double inside html tags. ;)
yep lol i learned that one the hard way.