Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Wrap $ in Tag?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33217
    realph
    Participant

    Anyone know how I’d wrap $likes in a span tag? If it’s even possible.

    $likes = likeThis($post_id);

    Sorry if I make no sense at all, I’m still trying to wrap my head around PHP.

    Thanks in advance.

    #82135
    Roxon
    Member

    By the way, what @TT_Mark did there is called concatenation. You can concatenate a string, such as “Hello World” to a variable or another string using a period/full stop, and you can do it as many times as you want.

    #82152
    realph
    Participant

    @TT_Mark Thanks for the help guys. That’s why I love this forum.

    I’m trying to modify a plugin called Like This.

    My PHP looks like this at the moment.

    function printLikes($post_id) {
    $likes = likeThis($post_id);

    $who = 'Love it? ';

    if(isset($_COOKIE["like_" . $post_id])) {
    print ''.$who. ''.$likes.' loves';
    return;
    } //if
    print ''.$who. ''. $likes.' loves';
    } //printLikes

    I’ve wrapped both $likes in a span tag. The span tag is present before I like the item, but when I “like” the item the span tag disappears, this is the one with the “done” class.

    Hope that makes sense, thanks.

    #82177
    ddliu
    Member

    Seems it been changed by the js.

    At the end of function reloadLikes(who)

    $j("#" + who).text(text);

    That might be the problem.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.