| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Auteur |
Message |
psaico

Inscrit le: 14 Mai 2008 Messages: 35
|
Posté le: Dim Mai 25, 2008 11:00 am Sujet du message: Function Last Topic |
|
|
Hi guys,
i have this function
| Code: |
<?php
function ShowLastTopic($id,$limit){
ob_start();
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
ob_end_flush();
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$sql = "SELECT DISTINCT(t.topic_id), t.forum_id, t.topic_title, t.topic_last_post_id, t.topic_status, t.topic_replies, t.topic_replies_real, t.topic_type, f.forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = $id
AND t.topic_status <> 2
AND t.forum_id = f.forum_id
ORDER BY t.topic_last_post_id DESC LIMIT $limit";
$result = $db->sql_query($sql);
$line = array();
while( $row = $db->sql_fetchrow($result)) {
$line[] = $row;
}
$db->sql_freeresult($result);
for( $i = 0; $i < count($line); $i++ )
{
$forum_name = $line[$i]['forum_name'];
$topic_id = $line[$i]['topic_id'];
$forum_id = $line[$i]['forum_id'];
$post_id = $line[$i]['topic_last_post_id'];
$topic_title = censor_text($line[$i]['topic_title']);
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $line[$i]['topic_replies_real'] : $line[$i]['topic_replies'];
$start = floor(($replies) / $config['posts_per_page']) * $config['posts_per_page'];
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if (empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
if ($line[$i]['topic_type'] == POST_GLOBAL) {
$phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
}
$phpbb_seo->seo_censored[$topic_id] = $topic_title;
$phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
}
if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
$phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id . '&f=' . $forum_id . '&start=' . $start ) . '#p' . $post_id;
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start");
echo '<a href="' . $post_url . '">recent post</a> to "';
echo '<a href="'. $topic_url .'">'. $topic_title .'</a>"<br/>';
}
}
ShowLastTopic(2,10);
?>
|
and have this error:
| Code: |
Fatal error: Call to a member function on a non-object in /home/mhd-01/www.big-bug.net/htdocs/forum/includes/cache.php on line 51
|
Why? Is a OOP error?
Thx @ all .. |
|
|
| Revenir en haut de page |
|
 |
|
 |
SeO Administrateur - Site Admin

Inscrit le: 15 Mar 2006 Messages: 3477
|
|
| Revenir en haut de page |
|
 |
|
| Navigation |
Autres sujets de discussion |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |