Skip to:
Content
Pages
Categories
Search
Top
Bottom

PHP Character Limit for Latest Topic

  • Hi,

    So I’m trying to display the latest topic of a forum on the home page with a link to that forum.

    How do I go about limiting the output to 40 characters?

    Currently I’m using this code

    <td class="num"><?php echo "<a href='"; topic_last_post_link(forum_last_topic_id()); echo "'>"; topic_title(forum_last_topic_id()); echo "</a>"; ?></td>

    Any help appreciated.

    Thanks,

    Ash

Viewing 1 replies (of 1 total)

  • abdessamad idrissi
    Participant

    @abdessamad-idrissi

    you got lot of echos there man!.. make it simple

    <td class="num">
    <?php echo "<a href='" . topic_last_post_link(forum_last_topic_id()). "'>". topic_title(forum_last_topic_id())."</a>"; ?>
    </td>

    to limit the characters, use the substr php function -google it :)

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar