Ich habe den Mod von phpBB2 an phpBB3 angepasst und aus Bequemlichkeit einfach einen SVN-Patch für eine blanke Installation erstellt:
editiert am 14.02.2007, 23:43
+ Begrenzung der Keywords mittels Variable
+ minimale Keyword Länge mittels Variable
+ lange Keywords zuerst (Länge absteigend)
Code: Alles auswählen
Index: F:/htdocs/phpBB3/styles/subsilver2/template/overall_header.html
===================================================================
--- F:/htdocs/phpBB3/styles/subsilver2/template/overall_header.html (revision 255)
+++ F:/htdocs/phpBB3/styles/subsilver2/template/overall_header.html (working copy)
@@ -9,8 +9,8 @@
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2002-2006 phpBB Group" />
-<meta name="keywords" content="" />
-<meta name="description" content="" />
+{META_DESCRIPTION}
+{META_KEYWORDS}
{META}
<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title>
Index: F:/htdocs/phpBB3/styles/prosilver/template/overall_header.html
===================================================================
--- F:/htdocs/phpBB3/styles/prosilver/template/overall_header.html (revision 255)
+++ F:/htdocs/phpBB3/styles/prosilver/template/overall_header.html (working copy)
@@ -9,8 +9,8 @@
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2002-2006 phpBB Group" />
-<meta name="keywords" content="" />
-<meta name="description" content="" />
+{META_DESCRIPTION}
+{META_KEYWORDS}
{META}
<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title>
Index: F:/htdocs/phpBB3/viewtopic.php
===================================================================
--- F:/htdocs/phpBB3/viewtopic.php (revision 255)
+++ F:/htdocs/phpBB3/viewtopic.php (working copy)
@@ -1561,7 +1561,7 @@
}
// Output the page
-page_header($user->lang['VIEW_TOPIC'] .' - ' . $topic_data['topic_title']);
+page_header($topic_data['topic_title']);
$template->set_filenames(array(
'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html')
Index: F:/htdocs/phpBB3/includes/functions.php
===================================================================
--- F:/htdocs/phpBB3/includes/functions.php (revision 255)
+++ F:/htdocs/phpBB3/includes/functions.php (working copy)
@@ -3301,11 +3301,87 @@
// Which timezone?
$tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
+ // META MOD
+ $min_word_length = 5;
+ $max_word_count = 5;
+ $topic_id = 0;
+ $forum_id = 0;
+ $meta_description = '';
+ $meta_keywords = '';
+
+ if (!isset ($_GET['mode']))
+ {
+ if (isset ($_GET['t']) && ((int) $_GET['t']>0))
+ {
+ $topic_id = (int) $_GET['t'];
+ }
+ elseif (isset ($_GET['f']) && ((int) $_GET['f']>0))
+ {
+ $forum_id = (int) $_GET['f'];
+ }
+ }
+
+ if ($topic_id)
+ {
+ $sql = "SELECT f2.forum_name AS parent_forum_name,
+ f.forum_name,
+ t.topic_title
+ FROM " . TOPICS_TABLE . " t,
+ " . FORUMS_TABLE . " f
+ LEFT JOIN " . FORUMS_TABLE . " f2 ON f2.forum_id = f.parent_id
+ WHERE f.forum_id = t.forum_id
+ AND t.topic_id = $topic_id";
+ $result = $db->sql_query ($sql);
+ $row = $db->sql_fetchrow ($result);
+ $db->sql_freeresult ($result);
+
+ if ($row['parent_forum_name'])
+ $meta_description = $row['parent_forum_name'] . ' :: ' . $row['forum_name'] . ' :: ' . $row['topic_title'];
+ else $meta_description = $row['forum_name'] . ' :: ' . $row['topic_title'];
+ $meta_description = '<meta name="description" content="' . $meta_description . '">';
+
+ $sql = "SELECT w.word_text
+ FROM " . TOPICS_TABLE . " t,
+ " . SEARCH_WORDMATCH_TABLE . " m,
+ " . SEARCH_WORDLIST_TABLE . " w
+ WHERE t.topic_first_post_id = m.post_id
+ AND m.word_id = w.word_id
+ AND t.topic_id = $topic_id
+ AND LENGTH(w.word_text)>=$min_word_length
+ ORDER BY LENGTH(w.word_text) DESC
+ LIMIT $max_word_count";
+ $result = $db->sql_query ($sql);
+
+ $meta_keywords = '';
+ while ($row = $db->sql_fetchrow ($result))
+ {
+ $meta_keywords .= (!$meta_keywords) ? $row['word_text'] : ',' . $row['word_text'];
+ }
+ $db->sql_freeresult ($result);
+ $meta_keywords = '<meta name="keywords" content="' . $meta_keywords . '">';
+ }
+
+ if ($forum_id)
+ {
+ $sql = "SELECT f.forum_name,
+ f.forum_desc
+ FROM " . FORUMS_TABLE . " f
+ WHERE f.forum_id = $forum_id";
+ $result = $db->sql_query ($sql);
+ $row = $db->sql_fetchrow ($result);
+ $db->sql_freeresult ($result);
+
+ $meta_keywords = '<meta name="keywords" content="' . str_replace (" ", ",", $row['forum_name']) . '">';
+ $meta_description = '<meta name="description" content="' . $row['forum_desc'] . '">';
+ }
+
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
'SITE_DESCRIPTION' => $config['site_desc'],
'PAGE_TITLE' => $page_title,
+ 'META_DESCRIPTION' => $meta_description,
+ 'META_KEYWORDS' => $meta_keywords,
'SCRIPT_NAME' => str_replace('.' . $phpEx, '', $user->page['page_name']),
'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit),
'LAST_VISIT_YOU' => $s_last_visit,
Index: F:/htdocs/phpBB3/viewforum.php
===================================================================
--- F:/htdocs/phpBB3/viewforum.php (revision 255)
+++ F:/htdocs/phpBB3/viewforum.php (working copy)
@@ -133,7 +133,7 @@
}
// Dump out the page header and load viewforum template
-page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name']);
+page_header($forum_data['forum_name']);
$template->set_filenames(array(
'body' => 'viewforum_body.html')
Für alle, die mit SVN nicht so firm sind:
Minus (-) bedeutet, dass diese Stelle rausgeflogen ist.
Plus (+) bedeutet dass diese Stelle hinzugefügt wurde.
Einrückungen wurden leider nicht korrekt übernommen.
Grüße BN