TinyPortal
Development => Block Codes => Topic started by: Freddy on October 13, 2009, 02:50:32 PM
This was requested so as to provide more flexibility in the front page layout.
It simply mimics TP's front page settings for posts, specifically this setting :
What to display on frontpage: Only forum-posts
You can set the boards from which to pull posts from, the number of posts to show and the number of characters to display before you get a Read More link.
Very simple bit of code because I used Bloc's pre-existing functions to do all the work.
You can use this in a PHP block or article.
// *** Config ***
// Set the boards you want to pull from - comma seperated within quotes.
$boards = '1,2,3';
// Set the total number of posts to show.
$number = 5;
// Set the maximum number of characters to show in a post.
$length = 300;
// *** End of config ***
// Now the code...
$posts = array();
$posts = TP_boardNews($boards, $number, 0, $length);
foreach ($posts as $post)
{
TPpageLayout1($post, 0);
}