Welcome, Guest. Please login or register.
Did you miss your activation email?
July 23, 2014, 12:15:28 PM

Login with username, password and session length

Last 25 Topics



Note:  Clicking the link above will open a new tab in your browser !!

Recent

Members
Stats
  • Total Posts: 173591
  • Total Topics: 19823
  • Online Today: 73
  • Online Ever: 278
  • (October 31, 2012, 08:52:18 AM)
Users Online
Users: 0
Guests: 55
Total: 55

Donate

Help us to keep the support site
going, Please consider a small donation.

Thank you
Please read the Posting Guidelines

Author Topic: [Block] Multi-Functional posts and topics snippet  (Read 2313 times)

0 Members and 1 Guest are viewing this topic.

Megaforum

  • Guest
[Block] Multi-Functional posts and topics snippet
« on: August 11, 2008, 11:24:37 AM »
type:   php
author:   Dragooon
name:   Multi-Functional posts and topics snippet
version:   3
date:   January 3 2008
discussion topic:   Pending

Features
# Have 4 modes
  • Recent Posts
  • Recent Topics
  • Top Viewed
  • Top Replied
# You have the ability to select weather to show from sticky topics only or from all topics
# Can be set to show topics/posts from a defined single board, all the boards, or multiple set of boards
# Can be set to show topics/posts from a defined category, all categories or multiple selected categores
# Easy customization, Every customization is at one place, and is greatly instructed with comments
# Ability to set a character limit to subject
# Ability to show some part of the posts/topics body and ability set its character limit
# Supports all 3 kinds of blocks(Left, Right and Center)
# Works with permission, A user sees what it can see.
# Amount of topics/post to output can be changed
# Supports scroll
# Supports Auto Scroll
# Parses BBC and there is a option weather to Parse Smiley or not
# Have various options to show various attributes of the topic/post.

Implementation
Step 1 :
Download the PHP File I attached (PostsTopicsSnippet.php) and Upload it to your Sources(/Sources) Directory.
Step 2 :
In a PHP Block add this code
Code: [Select]
// Posts/Topics Snippet
// By Dragooon
// www.smf-media.com
// Version 3.0
// @TinyPortal : http://www.tinyportal.net/index.php?topic=25435.0

//The instructions are posted in the thread of this snippet + they are quite here.

// Lets call the file
global $sourcedir;
require_once($sourcedir . '/PostsTopicsSnippet.php');

// Declare it. There is NO need to edit this part
$boards_id = array();
$cats_id = array();
/************************************
* How To Customize!
************************************/
# This is how to customize the block. To customize this please edit the variable given in the Below function call (postsTopicsSnippet). Do Not edit the variables given in this How To. This How to explains, what is the variable is and what does it do.
# How to Customize is given below.
# Make sure not to remove ANY comma
# Make sure not to remove "array()" part in the $boards_id and $cats_id variables.

# $mode : Mode of the Block
# 1 = Recent Topics
# 2 = Recent Posts
# 3 = Top Viewed
# 4 = Top Replied

# $boards_id : ID Of Boards to show the posts/topics from
# Do Not remove array() part, Insert the ID(s) of boards you want posts to show from.
# Use comma ( , ) as a separator
# Example : $boards_id = array(1, 2, 3)
# Leave empty to grab posts from all boards

# $cats_id : ID Of categories to show the posts/topics from
# Do Not remove array() part, Insert the ID(s) of categories you want posts to show from.
# Use comma ( , ) as a separator
# Example : $cats_id = array(1, 2, 3)
# Leave empty to grab posts from all categories

# $stickyOnly : Weather to get the topics which are sticky only or not
# true : yes
# false : no

# $limit : Maximum no. of topics/posts to show

# $subjectLength : Max characters the subject can have.

# $bodylength : Max characters the subject can have
# Setting it to 0 will result showing of no body.

# Below are some configuration variables
# For these, if set to true, it means Yes.
# If set to false, it means no.

# $parseSmileys : Weather to parse smileys or not

# $show_board : Weather to show the board the topic/post is posted in or not

# $show_views : Weather to show the no. of views or not

# $show_replies : Weather to show the no. of replies or not

# $show_category : Weather to show category or not

# $show_author : Weather to show the author who posted this or not

# $show_newIcon : If the post is unread, weather to show the New Icon or not

# $show_time : Weather to show the time the post/topic is posted on or not

# $scroll : If the height it longer than 40 pixels, weather to make it as a scroll or not

# $aScroll : Weather to make it auto scroll or not
# NOTE : If $scroll AND $aScroll are both true, $scroll turns back to false so that it doesn't clashes.
/************************************
* End How to Customize!
************************************/

/************************************
* The Function!
************************************/
postsTopicsSnippet(
$mode = 1,
$boards_id = array(),
$cats_id = array(),
$stickyOnly = false,
$limit = 5,
$subjectLength = 25,
$bodylength = 100,
$parseSmileys = true,
$show_board = true,
$show_views = true,
$show_replies = true,
$show_category = true,
$show_author = true,
$show_newIcon = true,
$show_time = true,
$scroll = true,
$aScroll = false
);

//Thank you for using this Code snippet.
And you are done :).
« Last Edit: March 23, 2010, 11:56:39 AM by freddy888 »