Differences

This shows you the differences between the selected revision and the current version of the page.

dev:integration 2008/09/30 01:44 dev:integration 2020/02/06 11:04 current
Line 1: Line 1:
-====== PunBB 1.3 integration ====== +Moved to [[punbb13:integration]].
- +
-===== General ===== +
- +
- +
-===== Common tasks ===== +
- +
-==== Recent 10 posts ==== +
-<code php> +
-<?php +
- +
-define('RECENT_POSTS_SHOW_POST', true); // Set to false to show topic subject only +
-define('RECENT_POSTS_MAX_POST_LENGTH', 20); // Limit length of the post text displayed +
- +
-if (!defined('FORUM_ROOT')) +
- define('FORUM_ROOT', './'); +
- +
-require_once FORUM_ROOT.'include/common.php'; +
- +
-// Get 10 lastest posts +
-$query = array( +
- 'SELECT' => 'p.id, p.message, t.subject', +
- 'FROM' => 'posts AS p', +
- 'JOINS' => array( +
- array( +
- 'LEFT JOIN' => 'topics AS t', +
- 'ON' => 'p.topic_id = t.id' +
-+
- ), +
- 'ORDER BY' => 'p.posted DESC', +
- 'LIMIT' => '0,10' +
-); +
- +
-$result = $forum_db->query_build($query) or error(__FILE__, __LINE__); +
- +
-$recent_posts = array(); +
-while ($cur_post = $forum_db->fetch_assoc($result)) +
- $recent_posts[] = $cur_post; +
- +
-// Print out posts +
-if (!empty($recent_posts)) +
-+
- ?> +
- <ul> +
- <?php +
- foreach($recent_posts as $cur_post) +
-+
- +
- echo '<li><a href="', forum_link($forum_url['post'], $cur_post['id']), '">', $cur_post['subject'], '</a>'; +
- +
- if (RECENT_POSTS_SHOW_POST) +
-+
- if (utf8_strlen($cur_post['message']) > RECENT_POSTS_MAX_POST_LENGTH) +
- $cur_post['message'] = utf8_substr($cur_post['message'], 0, RECENT_POSTS_MAX_POST_LENGTH).'…'; +
- +
- echo '<br />', "\n", $cur_post['message']; +
-+
- +
- echo '</li>'; +
-+
- ?> +
- </ul> +
- <?php +
-+
- +
-?> +
-</code>+

Personal Tools