Last posts text limit characters in phpbb

101 views Asked by At

I found this code for showing last posts in phpbb forum. I wanna set charatcters limit in post_text.

<?php
    // Now let's output the content
    // A ted vypsat obsah
    while ($row = $db->sql_fetchrow($result))
    {
$url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&amp;t={$row['topic_id']}&amp;p={$row['post_id']}#p{$row['post_id']}"; //added fedforum to url
$urlmini = generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$row['poster_id']}"; //added fedforum to url
//old line $url = generate_board_url() . "viewtopic.{$phpEx}?f={$row['forum_id']}&amp;t={$row['topic_id']}&amp;p={$row['post_id']}#p{$row['post_id']}";      
 echo '<small><a target="_blank" href="' . $url . '">' . $row['post_subject']. '</a><br>'. $row['post_text'] .'<br>od: <a target="_blank" href="' . $urlmini . '">' . ucwords($row['username']).'</a>' . ' v '.'<font style="color:#aaa;">' . date("H:i",$row['post_time']).'</font>', '<br><br></small>';
    }
    ?>

Does anybody know how to set characters limit for $row['post_text'] ?

1

There are 1 answers

0
Manish Jangir On BEST ANSWER

you can use

substr($row['post_text'],0,40);

or change 40 to any limit as you want