views:

96

answers:

2
function formatUpdate($tweet,$dt,$picture,$username)
{
    if(is_string($dt)) $dt=strtotime($dt);

    $tweet=htmlspecialchars(stripslashes($tweet));


       $at = "@" . $username;




    return'
    <li>
    <a href="nano.com/' . $username . '"><img class="avatar" src="images/' . $picture . '" width="48" height="48" alt="avatar" /></a>
    <div class="tweetTxt">
    <strong><a href="nano.com/' . $username . '">' . $username . '</a></strong> '. preg_replace('/((?:http|https|ftp):\/\/(?:[A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?[^\s\"\']+)/i','<a href="$1" rel="nofollow" target="blank">$1</a>',$tweet).'
    <div class="date">'.relativeTime($dt).'</div> <a class ="reply"  href="?replyto=' echo $at;   '">reply</a>
    </div>
    <div class="clear"></div>
    </li>';

}
+1  A: 

bolt is right. often concat issue has to do with a confusion of mixed in code, literals, and closing quotes/double-quotes. try to use heredoc instead to clean up your code-block.

for example, i would do the following to save my eyes staring at the code and to save my mind from insanity trying to find where the syntax error is (pseudo-coding only):

$at = "@$username";
$rt = relativeTime($dt);

$out = <<<raw
    <div class="date">$rt</div>
    <a class ="reply" href="?replyto=$at">reply</a>
raw;

just look at how much simpler it looks eh?

to learn about heredoc here's a reading reference.

ref: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

alien052002
A: 

To append the value of a variable to a string you need not echo the variable.

You have

href="?replyto=' echo $at;   '">reply</a>

Change it to

href="?replyto='. $at .'">reply</a>
codaddict
your right thanks, but the problem it on the page it shows a @username instead of "reply" link? its wierd. i think im doing the concat wrong
getaway