I have a phpBB 3.0.4 set up and downloaded Frontpage News Syndication by chAos version 1.0.0. I like to set up a few pages using this mod, but I just can't figure it out for the life of me. Also, here is a link to the site I am building: Animania
Technical Information
Files and locations:
root/news.php
root/club_info.php
root/styles/prosilver_se/template/club_info.html
Codes
news.php
Code: Select all
<?php
/******************************************************************************
* POST SYNDICATION SCRIPT by chAos
*
* A very basic script that pulls threads with the first post from the database
* and puts them into an array form so you can use them as you like.
*
* For use with phpBB3, freely distributable
*
******************************************************************************/
/** Notes:
*
* - Attachments haven't been handled properly.
* - Starts a forum session as Guest user, taking all the default values for time, bbcode style (from theme), etc
* - While viewing this page, users will appear to be viewing the Forum Index on viewonline.php.
* This can't be helped without modifying other code which is beyond this
*
*/
//////////////////////////////////////
//
define('FORUM_ID', 28); // Forum ID to get data from
define('POST_LIMIT', 1); // How many to get
define('PHPBB_ROOT_PATH', './'); // Path to phpBB (including trailing /)
define('PRINT_TO_SCREEN', true);
// If set to true, it will print the posts out
// If set to false it will create an array $news[] with all the following info
//
// 'topic_id' eg. 119
//
// 'topic_time' eg. 06 June, 07 (uses board default)
// 'topic_replies' eg. 26
//
// 'username' eg. chAos
// 'topic_title' eg. "News Post"
//
// 'post_text' eg. just the text (formatted w/ smilies, bbcode, etc)
//
//////////////////////////////////////
define('IN_PHPBB', true);
// Specify the path to you phpBB3 installation directory.
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// The common.php file is required.
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin(false);
$auth->acl($user->data);
// specify styles and/or localisation
// in this example, we specify that we will be using the file: my_language_file.php
$user->setup('mods/my_language_file');
$query =
"SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid
FROM ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TABLE." p
WHERE u.user_id = t.topic_poster
AND u.user_id = p.poster_id
AND t.topic_id = p.topic_id
AND p.post_id = t.topic_first_post_id
AND t.forum_id = ".FORUM_ID."
ORDER BY t.topic_time DESC";
$result = $db->sql_query_limit($query, POST_LIMIT);
$posts = array();
$news = array();
$bbcode_bitfield = '';
$message = '';
$poster_id = 0;
while ($r = $db->sql_fetchrow($result))
{
$posts[] = array(
'topic_id' => $r['topic_id'],
'topic_time' => $r['topic_time'],
'username' => $r['username'],
'topic_title' => $r['topic_title'],
'post_text' => $r['post_text'],
'bbcode_uid' => $r['bbcode_uid'],
'bbcode_bitfield' => $r['bbcode_bitfield'],
'topic_replies' => $r['topic_replies'],
);
$bbcode_bitfield = $bbcode_bitfield | base64_decode($r['bbcode_bitfield']);
}
// Instantiate BBCode
if ($bbcode_bitfield !== '')
{
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
// Output the posts
foreach($posts as $m)
{
$poster_id = $m['user_id'];
$message = $m['post_text'];
if($m['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $m['bbcode_uid'], $m['bbcode_bitfield']);
}
$message = str_replace("\n", '<br />', $message);
$message = smiley_text($message);
$comment = ($m['topic_replies']==1) ? 'comment' : 'comments';
if( PRINT_TO_SCREEN )
{
/* Output is in the following format
*
* <h3>Thread Title</h3>
^ <h4 class="postinfo">date // 5 comments // poster</h4>
* <p>First post test</p>
*
*/
echo "\n\n<h3>{$m['topic_title']}</h3>";
echo "\n<h4 class=\"postinfo\">".$user->format_date($m['topic_time'])." // <a href=\"".PHPBB_ROOT_PATH."viewtopic.php?f=".FORUM_ID."&t={$m['topic_id']}\">{$m['topic_replies']} {$comment}</a> // {$m['username']}</h4>";
echo "\n<p>{$message}</p>";
}
else
{
$news[] = array(
'topic_id' => $m['topic_id'], // eg: 119
'topic_time' => $user->format_date($m['topic_time']), // eg: 06 June, 07 (uses board default)
'topic_replies' => $m['topic_replies'], // eg: 26
'username' => $m['username'], // eg: chAos
'topic_title' => $m['topic_title'], // eg: "News Post"
'post_text' => $message, // just the text
);
}
unset($message,$poster_id);
}
/**
$news_print = outputNews();
$template->assign_vars(array(
'NEWS_PRINT' => $news_print,
));
**/
?>
Code: Select all
<?php
/**
*
* @author Original Author Username author_email@domain.tld - http://mywebsite.tld
* @author Another Author Username another_email@domain.tld - http://domain.tld
*
* @package {PACKAGENAME}
* @version $Id$
* @copyright (c) 2007 Your Group Name
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
// Specify the path to you phpBB3 installation directory.
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// The common.php file is required.
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
// specify styles and/or localisation
// in this example, we specify that we will be using the file: my_language_file.php
$user->setup('mods/my_language_file');
// Page title, this language variable should be defined in the language file you setup at the top of this page.
page_header($user->lang['MY_TITLE']);
// Set the filename of the template you want to use for this file.
// This is the name of our template file located in /styles/<style>/templates/.
$template->set_filenames(array(
'body' => 'club_info.html',
));
// Completing the script and displaying the page.
page_footer();
?>
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
<head>
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="{S_USER_LANG}" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="" />
{META}
<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title>
<!--
phpBB style name: prosilver
Based on style: prosilver (this is the default phpBB3 style)
Original author: Tom Beddard ( http://www.subBlue.com/ )
Modified by:
NOTE: This page was generated by phpBB, the free open-source bulletin board package.
The phpBB Group is not responsible for the content of this page and forum. For more information
about phpBB please visit http://www.phpbb.com
-->
<script type="text/javascript">
// <![CDATA[
var jump_page = '{LA_JUMP_PAGE}:';
var on_page = '{ON_PAGE}';
var per_page = '{PER_PAGE}';
var base_url = '{A_BASE_URL}';
var style_cookie = 'phpBBstyle';
var style_cookie_settings = '{A_COOKIE_SETTINGS}';
var onload_functions = new Array();
var onunload_functions = new Array();
<!-- IF S_USER_PM_POPUP -->
if ({S_NEW_PM})
{
var url = '{UA_POPUP_PM}';
window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
}
<!-- ENDIF -->
/**
* Find a member
*/
function find_username(url)
{
popup(url, 760, 570, '_usersearch');
return false;
}
/**
* New function for handling multiple calls to window.onload and window.unload by pentapenguin
*/
window.onload = function()
{
for (var i = 0; i < onload_functions.length; i++)
{
eval(onload_functions[i]);
}
}
window.onunload = function()
{
for (var i = 0; i < onunload_functions.length; i++)
{
eval(onunload_functions[i]);
}
}
// ]]>
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/styleswitcher.js"></script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/forum_fn.js"></script>
<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<style type="text/css">
/* CUSTOM BACKGROUNDS
---------------------------------------- */
.headerbar {
background-image: url("/images/backgrounds/bg_header6.gif");
}
</style>
<link href="{T_THEME_PATH}/normal.css" rel="stylesheet" type="text/css" title="A" />
<link href="{T_THEME_PATH}/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
<link href="{T_THEME_PATH}/large.css" rel="alternate stylesheet" type="text/css" title="A++" />
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
<!-- ENDIF -->
<!-- Image Slideshow START -->
<script src="/images/welcome_images/getimages.php"></script>
<script type="text/javascript">
var curimg=0
function rotateimages(){
document.getElementById("slideshow2").setAttribute("href", "images/welcome_images_l/"+galleryarray[curimg])
document.getElementById("slideshow").setAttribute("src", "images/welcome_images/"+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}
function runSlideShow(){
setInterval("rotateimages()", 5000)
}
</script>
<!-- Image Slideshow END-->
<!-- Start of Lightbox installed by Johnson-->
<script type="text/javascript" src="scripts/shadowbox/build/adapter/shadowbox-base.js"></script>
<script type="text/javascript" src="scripts/shadowbox/build/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.loadSkin('classic', 'scripts/shadowbox/src/skin'); // use the "classic" skin
Shadowbox.loadLanguage('en', 'scripts/shadowbox/build/lang'); // use the English language
Shadowbox.loadPlayer(['img', 'iframe', 'html'], 'scripts/shadowbox/build/player'); // use img and qt players
function runShadowbox() {
Shadowbox.init();
}
function getFunc() {
runShadowbox();
runSlideShow();
}
</script>
<!-- End of Fancy Lightbox installed by Johnson-->
</head>
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}" onload="getFunc()">
<div id="wrap">
<div class="border-left">
<div class="border-right">
<div class="border-top">
<div class="border-top-left">
<div class="border-top-right">
<div class="inside" style="direction: {S_CONTENT_DIRECTION}; ">
<a id="top" name="top" accesskey="t"></a>
<div id="page-header">
<div class="headerbar" onclick="location.href='{MAIN_INDEX}';" style="cursor:pointer;">
<div class="inner"><span class="corners-top"><span></span></span>
<div id="site-description">
<a title="{MAIN_TITLE}" id="logo">{SITE_LOGO_IMG}</a><br /><br /><br /><br /><br />
<p style="display: none;"><a href="#start_here">{L_SKIP}</a></p>
</div>
</div>
<!-- INCLUDE site_menu.html -->
<span class="corners-bottom"><span></span></span></div></div><div>
<table width="100%">
<tr>
<td valign="top">
<h3>Club Info</h3><br />
<?php include("news.php"); ?>
</td>
</tr>
</table>
<br /><br /><br />
<!-- INCLUDE overall_footer.html -->
By the way, club_info.php is an extra page that calls club_info.html as a template body.