Re: "Similar Topics" für Content-Seite
Verfasst: 09.06.2010 16:22
Ich habe schon andere keywords ausprobiert ... keine Ergebnisse ...
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
<?php
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);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$keyword = 'rosen';
// Begin similar topics
$sql_array = array(
'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, u.user_id, u.username, u.user_colour, t.topic_replies',
'FROM' => array(
TOPICS_TABLE => 't',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 'u.user_id = t.topic_poster'
),
array(
'FROM' => array(FORUMS_TABLE => 'f'),
'ON' => 'f.forum_id = t.forum_id'
),
),
'WHERE' => "MATCH (t.topic_title) AGAINST ('" . $db->sql_escape($keyword) . "') >= 0.5
AND t.topic_status <> " . ITEM_MOVED,
'GROUP_BY' => 't.topic_id',
'ORDER_BY' => 't.topic_last_post_time DESC'
);
$sql = $db->sql_build_query('SELECT', $sql_array);
if ($result = $db->sql_query_limit($sql, 5))
{
while($similar = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $similar['forum_id']))
{
$similar_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=" . $similar['forum_id']);
$similar_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $similar['forum_id'] . '&t=' . $similar['topic_id']);
$similar_user = get_username_string('full', $similar['user_id'], $similar['username'], $similar['user_colour'], $similar['username']);
$template->assign_block_vars('similar', array(
'TOPIC_TITLE' => $similar['topic_title'],
'U_TOPIC' => $similar_topic_url,
'REPLIES' => $similar['topic_replies'],
'USER' => $similar_user,
'U_FORUM' => $similar_forum_url,
'FORUM' => $similar['forum_name'])
);
}
}
}
// End Similar Topics
// Page output
page_header($keyword);
$template->set_filenames(array(
'body' => 'similar-content.html',
));
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
Code: Alles auswählen
<!-- INCLUDE overall_header.html -->
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top:5px">
<tr>
<th colspan="3" align="left">{L_SIMILAR_TOPICS}</th>
</tr>
<!-- IF .similar -->
<!-- BEGIN similar -->
<tr><td class="row1"><a href="{similar.U_TOPIC}" class="topictitle">{similar.TOPIC_TITLE}</a></td>
<td class="row2">{L_FORUM}: <a href="{similar.U_FORUM}">{similar.FORUM}</a></td>
<td class="row1">{L_REPLIES}: {similar.REPLIES}</td>
</tr>
<!-- END similar -->
<!-- ELSE -->
<tr><td class="row1" colspan="3" align="center"><strong>{L_NO_POSTS}</strong></td></tr>
<!-- ENDIF -->
</table>
<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
Code: Alles auswählen
<!-- INCLUDE overall_header.html -->
<!-- IF .similar -->
<table class="tablebg" width="100%" cellspacing="1" cellpadding="0" style="margin-top:5px">
<tr>
<th colspan="3" align="left">{L_SIMILAR_TOPICS}</th>
</tr>
<!-- BEGIN similar -->
<tr><td class="row1"><a href="{similar.U_TOPIC}" class="topictitle">{similar.TOPIC_TITLE}</a></td>
<td class="row2">{L_FORUM}: <a href="{similar.U_FORUM}">{similar.FORUM}</a></td>
<td class="row1">{L_REPLIES}: {similar.REPLIES}</td>
</tr>
<!-- END similar -->
</table>
<!-- ENDIF -->
<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
Code: Alles auswählen
page_header($keyword);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
Code: Alles auswählen
<!-- INCLUDE overall_header.html -->
<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
Code: Alles auswählen
$keyword = 'rosen';
Code: Alles auswählen
$keyword = utf8_normalize_nfc(request_var('keyword', '', true));
Code: Alles auswählen
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/phpBB/';
Code: Alles auswählen
Warning: include(/phpBB/common.php) [function.include]: failed to open stream: No such file or directory in /www/htdocs/xxx/phpBB/similar.inc.php on line 6
Warning: include() [function.include]: Failed opening '/phpBB/common.php' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/xxx/phpBB/similar.inc.php on line 6
Fatal error: Call to a member function session_begin() on a non-object in /www/htdocs/xxx/phpBB/similar.inc.php on line 9
Code: Alles auswählen
<?
include ($_SERVER['DOCUMENT_ROOT']."/phpBB/similar.inc.php?keyword=rosen")
?>
Code: Alles auswählen
Warning: include(/www/htdocs/xxx//phpBB/similar.inc.php?keyword=rosen) [function.include]: failed to open stream: No such file or directory in /www/htdocs/xxx/x
Warning: include() [function.include]: Failed opening '/www/htdocs/xxx//phpBB/similar.inc.php?keyword=rosen' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/xxx/x
Code: Alles auswählen
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
Code: Alles auswählen
The config.php file could not be found.
Click here to install phpBB
Code: Alles auswählen
if (!file_exists($phpbb_root_path . 'config.' . $phpEx))
{
die("<p>The config.$phpEx file could not be found.</p><p><a href=\"{$phpbb_root_path}install/index.$phpEx\">Click here to install phpBB</a></p>");
}
Code: Alles auswählen
$keyword = 'rosen';
Code: Alles auswählen
<?
define('PHPBB_ROOT_PATH', './../../phpBB3/');
$keyword = 'rosen';
include (PHPBB_ROOT_PATH . 'similar.inc.php');
?>
Code: Alles auswählen
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';