phpbb Forum questions I got

Reaction score
125
Here are some questions i have for you tech heads: :p

1.Is there anyway to get information onto my main site just like SMF did with there SSI codes and stuff.

2. How can i make it so that whene it shows the LAST POST:

Code:
20 Oct 2000 05:01 pm
MeRcChRiS

itll show

Code:
[last post name&link to it]
by MeRcChRiS
on 20 Oct 2000 05:01 pm

3.I have more but i cant think of anything atm, so ill post in here again with more questions as i go along, Thanks.
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
1. You would have to get it out of the MySQL database, via your own PHP code.
2. I do belive its either an option, or you get a mod.
 

TFlan

I could change this in my User CP.
Reaction score
64
Here it is:

Just place this where you want the latest topics to show.

Code:
<?php
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
#   Applet  :   phpBB Latest Topic Displayer
#   Author  :   Jonathan Wolf <[email protected]>, M.S.
#   Version :   v1.0 (2-20-06)
#   Changes :   v1.0 (2-20-06): Brand new.
#
#   Description:
#       This script takes the latest topics from the phpBB forum and
#       displays these topics in a quick overview fashion. This is a
#       perfect idea for such things as a news page that takes its
#       topics from an Announcements page, or a quick overview of the
#       latest topics from any specific forum, whatever it may be.
#       You may modify this to fit your needs - although do not think
#       that I will help you do this, I am not your technical support.
#       As such, this script is aimed at web dev's making a website
#       with a phpBB forum, so some amount of knowledge of PHP and
#       MySQL is here-in required. This script will thus provide three
#       stages: querying (singular), processing, displaying.
#
#   Comments:
#       Thanks to clericvash <[email protected]> for the "Topic
#       Extraction" script and for some of the very lovely technicality
#       resolutions, such as the BB-code conversions and phpBB header
#       includes and all that jazz. I added to it a few things myself.
#
#   License:
#       Not that most people would care but I consider this script to be
#       in the public domain, do what you like, but please give me credit.
#
#   Installation:
#       1) Change control variables (below) and write your display routine
#          (also below, or just use the dummy display code) to match whatever
#          it is you like. You will need your forum_id handy, which shouldn't
#          be a problem for website admins running MySQL and/or phpMyAdmin.
#       2) Copy/paste, ssh/scp, FTP, or whatever, to your website.
#
#   Notes:
#       1) Feel free to change the way the script works.
#       2) For sake of simplicity, there is a series of variables that are
#          defined during the processing stage that will help you with writing
#          your display routine. Maybe not the best idea for efficiency but
#          readability is more important with public scripts like these.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Control Constants
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

// forum_id to grab topics from (must be a valid forum_id integer)
$forum_id = 1;

// How many of the newest topics to display
$limit_count = 6;

// Date and time format (used in PHP strftime() routine)
$date_time_format = "%e %b %I:%M %p";    // e.x. 20 Feb 12:29 am

// Path to phpBB's base directory (usually "forum/" or "phpBB/")
// Note: This is !required! to be set correctly for this script to work
// (phpBB's include files will reference this variable many times).
$phpbb_root_path = "forums/";

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# phpBB Connection Section
# This will give us a MySQL database connection ($db) to work with that
# is already initialized with the correct phpBB database for access.
# This also gives us some useful setup values such as the table prefix.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
if(!defined("IN_PHPBB"))
{
  define("IN_PHPBB", true);
  include($phpbb_root_path . "extension.inc");
  include($phpbb_root_path . "common.".$phpEx);
  include($phpbb_root_path . "config.".$phpEx);
}

if($db)     // Database connection check
{
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    # Database Query Section
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    // Grab our topics using a singular query
    $topics_query = $db->sql_query("
        SELECT
            {$table_prefix}topics.topic_title,
            {$table_prefix}users.username AS poster_name,
            {$table_prefix}topics.topic_time,
            {$table_prefix}posts_text.post_text AS topic_text,
            {$table_prefix}topics.topic_views,
            {$table_prefix}topics.topic_replies,
            {$table_prefix}topics.topic_id,
            {$table_prefix}posts_text.post_id,
            {$table_prefix}topics.topic_poster AS poster_id
        FROM
            {$table_prefix}topics,
            {$table_prefix}users,
            {$table_prefix}posts_text
        WHERE
            {$table_prefix}topics.forum_id = {$forum_id} AND
            {$table_prefix}users.user_id =
                {$table_prefix}topics.topic_poster AND
            {$table_prefix}posts_text.post_id =
                {$table_prefix}topics.topic_first_post_id
        ORDER BY topic_time DESC
        LIMIT {$limit_count};");
    
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    # Parsing Section
    #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    // Topic query-result existance check and non-zero row count check
    if($topics_query && mysql_num_rows($topics_query))
    {
        // Now go through all our selected topics for processing and display
        while($topic_entry = $db->sql_fetchrow($topics_query))
        {
            // The first thing we have to do is pre-process some things...
            // The post_text needs to have its BB-code replaced with actual
            // HTML code, which is a bit tricky and involves some fancy foot
            // work. Some of the following processing code is, as mentioned,
            // adapted from clericvash's "Topic Extraction" script. Cheers.
            
            // Set up some easy to use variables for parsing and displaying.
            $topic_title = $topic_entry["topic_title"];
            $poster_name = $topic_entry["poster_name"];
            $topic_time = strftime($date_time_format, $topic_entry["topic_time"]);
            $topic_text = $topic_entry["topic_text"];
            $topic_views = $topic_entry["topic_views"];
            $topic_replies = $topic_entry["topic_replies"];
            $topic_id = $topic_entry["topic_id"];
            $post_id = $topic_entry["post_id"];
            $poster_id = $topic_entry["poster_id"];
            $view_link = "{$phpbb_root_path}viewtopic.{$phpEx}?p={$post_id}";
            $reply_link = "{$phpbb_root_path}posting.{$phpEx}?mode=reply&t={$topic_id}";
            $poster_link = "{$phpbb_root_path}profile.{$phpEx}?mode=viewprofile&u={$poster_id}";
            
            // BB-Code processing
            
            // Extra character removal (these characters are identifiers that
            // are concatenated into the BB-code commands themselves in order
            // to help phpBB track appropriated opening and closing commands).
            $topic_text = preg_replace("/\:[0-9a-z\:]+\]/si", "]", $topic_text);
            // Bold
            $topic_text = str_replace("[b]", "<B>", $topic_text);
            $topic_text = str_replace("[/b]", "</B>", $topic_text);
            // Italics
            $topic_text = str_replace("[i]", "<I>", $topic_text);
            $topic_text = str_replace("[/i]", "</I>", $topic_text);
            // Underline
            $topic_text = str_replace("[u]", "<U>", $topic_text);
            $topic_text = str_replace("[/u]", "</U>", $topic_text);
            // Quote (style #1)
            $topic_text = preg_replace("/\[quote=(.*)\](.*)\[\/quote\]/Usi", "<DIV STYLE=\"padding: 7px\">$2</DIV>", $topic_text);
            // Quote (style #2)
            $topic_text = str_replace("[quote]", "<B>Quote:</B><BR><I>", $topic_text);
            $topic_text = str_replace("[/quote]", "</I>", $topic_text);
            // Code
            $topic_text = str_replace("[code]", "<B>Code:</B><BR><I>", $topic_text);
            $topic_text = str_replace("
", "</I>", $topic_text);
// List
$topic_text = preg_replace("/\[list\](.*)\[\/list\]/si", "<DIV STYLE=\"padding: 7px\">$1</DIV>", $topic_text);
$topic_text = preg_replace("/\
 
Reaction score
125
ok what do i do if i want it to show the latest topics from all the boards and not just one specific one?

cause here:

Code:
// forum_id to grab topics from (must be a valid forum_id integer)
$forum_id = 1;

i want to make it show the posts from all boards and not just 1 specific one
 
Reaction score
125
sorry to bump!

just need more help with that last post and this post.


How do i get a External login thing for my phpbb site that will go on my homepage?
 

Chile

The All Purpose Administrator
Reaction score
10
Hi

Sorry for the late reply. I'm sort of busy revamping um....rpgstars...yeah :D

You should be able to select more than one forum id if you separate the numbers with a ","

i.e.

WHERE forumid = 1,2,3

In mySQL queries, the * usually represents "all", but I'm not entirely certain whether you'll get results with the great asterisk in the WHERE of the query. :p
 

Chile

The All Purpose Administrator
Reaction score
10
$forum_id = 1,2,3,4

Every forum has an id that makes it unique from the other forums you may have created on your board. Each topic contained in the forum has a $forum_id included when the topic is created.

So, when the script writes:

$forum_id = 1

the script is only asking for the topics with the forum_id of "1" included in the data used to create the topic.

Ergo, if you want to include more forums from which to find new topics, you need to add the forum_id as written at the top of this reply. ;)
 

Chile

The All Purpose Administrator
Reaction score
10
Another way to rewrite this, and probably simpler too as as such:

$forum_id != 1

Will query the table for all topics where the forum id does not equal 1. So, if you wanted to present results for every forum except for your staff room, you would change the forum id
 

R@d14nc3

New Member
Reaction score
49
LoL, an admin just double-posted :eek::eek:bah np he's a neat admin after allHow many forum_ids exist?
 

Chile

The All Purpose Administrator
Reaction score
10
LoL, an admin just double-posted :eek::eek:bah np he's a neat admin after allHow many forum_ids exist?

meh,

I posted twice to show two different equations to the same solution.
I could also be wrong in my description of both. :p

in truth, I'm more of a designer type. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top