TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 12:23:30 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 86
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 79
  • Total: 79

[Block] TP-style recent post activity in a block.

Started by freddy888, October 13, 2009, 02:50:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Freddy

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);
}