A very common question about phpBB is how to display recents posts or topics on a separate page, such as a website homepage. It can be very handy to do this, as it allows visitors to your website a chance to quickly see recent activity.
This blog post details how displaying a list of recent posts and topics externally can be done. There are a couple of different formats that are covered:
The latest topics (including only from specified forums)
The first post of the latest topics (including from specified forums)
The latest posts from specified topics
The latest posts from the entire forum
Everything displayed is subject to the users forum read permissions.
With the information in this article you could either choose to make additions to a current php file or create a brand new php file. To start from the ground up, you need to create a new file (for example, home.php) and include the standard phpBB3 header information. The $phpbb_root_path variable may need to be altered depending on where the phpBB installation is located. If the file is in the same directory as the phpBB root (the same area as viewtopic.php, viewforum.php, etc) then the relative file path ‘./’ does not need to be changed.
If you have your phpBB installation in a directory separate to your main website, you will need to edit the $phpbb_root_path variable. Suppose phpBB was located in a directory called “forums” (ie. http://www.example.com/forums/) and you want the file home.php to be located in the website root directory (ie. http://www.example.com/home.php), then you would need to set the $phpbb_root_path to:
Code: Select all$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forums/';
To go “up” a directory, you can use ‘../’. You would use this if phpBB was installed in the website root directory (ie. http://www.example.com/) and you wanted to have your home.php script located in a sub-directory (ie. http://www.example.com/info/home.php).
The standard phpBB header looks like this: (bbcode.php needs to be included as when displaying the latest posts you may wish to parse the bbCode)
Code: Select all
Also, see the corresponding wiki article to this blog post at Displaying posts and topics on external pages
Posted on Mon, 09 Nov 2009 17:14:42 +0000 at http://blog.phpbb.com/2009/11/09/how-to-display-posts-and-topics-on-external-pages/
Comments: http://blog.phpbb.com/2009/11/09/how-to-display-posts-and-topics-on-external-pages/#comments
This blog post details how displaying a list of recent posts and topics externally can be done. There are a couple of different formats that are covered:
The latest topics (including only from specified forums)
The first post of the latest topics (including from specified forums)
The latest posts from specified topics
The latest posts from the entire forum
Everything displayed is subject to the users forum read permissions.
With the information in this article you could either choose to make additions to a current php file or create a brand new php file. To start from the ground up, you need to create a new file (for example, home.php) and include the standard phpBB3 header information. The $phpbb_root_path variable may need to be altered depending on where the phpBB installation is located. If the file is in the same directory as the phpBB root (the same area as viewtopic.php, viewforum.php, etc) then the relative file path ‘./’ does not need to be changed.
If you have your phpBB installation in a directory separate to your main website, you will need to edit the $phpbb_root_path variable. Suppose phpBB was located in a directory called “forums” (ie. http://www.example.com/forums/) and you want the file home.php to be located in the website root directory (ie. http://www.example.com/home.php), then you would need to set the $phpbb_root_path to:
Code: Select all$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forums/';
To go “up” a directory, you can use ‘../’. You would use this if phpBB was installed in the website root directory (ie. http://www.example.com/) and you wanted to have your home.php script located in a sub-directory (ie. http://www.example.com/info/home.php).
The standard phpBB header looks like this: (bbcode.php needs to be included as when displaying the latest posts you may wish to parse the bbCode)
Code: Select all
Also, see the corresponding wiki article to this blog post at Displaying posts and topics on external pages
Posted on Mon, 09 Nov 2009 17:14:42 +0000 at http://blog.phpbb.com/2009/11/09/how-to-display-posts-and-topics-on-external-pages/
Comments: http://blog.phpbb.com/2009/11/09/how-to-display-posts-and-topics-on-external-pages/#comments