• Hiya. I’m using this to get my last comments. I’m trying to add a bit of code so there will only be a “…” after the comment body if the comment isn’t shown in its entirety. This is what I’m using:

    ". if ($comment->com_excerpt >85) { echo "..."; } else { echo ""; } ."

    which returns “unexpected T_IF”. I’m no PHP expert, just learning all this stuff, but I assume this means it doesn’t like the if? Any ideas how to make this work?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anonymous User

    (@anonymized-3085)

    Does this work?

    $output .= "\n<li>".strip_tags($comment->comment_author)
    .":" . "<a href=\"" . get_permalink($comment->ID) .
    "#comment-" . $comment->comment_ID . "\" title=\"on " .
    $comment->post_title . "\">" . strip_tags($comment->com_excerpt);
    if ($comment->com_excerpt >85) {$output .= "..."; };
    $output .="</a></li>";

    Thread Starter thisisedie

    (@thisisedie)

    Nope, it didn’t work but thank you. get the same error. It really doesn’t seem to like the “if”. Sigh.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unexpected T_IF’ is closed to new replies.