Seite 1 von 1

Sitemap

Verfasst: 26.08.2005 14:08
von nasenkopf
Hallo,
Kann mir jemand bitte den Code für eine Sitemap geben, die nur eine bestimmte Kategorie auflistet?

Bei der normalen Sitemaps werden alle Threads aufgelistet.
Ich will aber nur, dass alle Themen von nur "einer" bestimmten Forum-Kategorie(ID) aufgelistet werden.

Wäre super wenn mir jemand helfen könnte.

Dies ist meine bestehende sitemap.php:

Wäre toll, wenn sie jemand für mich modifizieren könnte.
danke.

Code: Alles auswählen

<?php 
/*************************************************************************** 
* Save this file as: site_map.php (or anything you like) 
* Version: Friday, Oct 4, 2002 
* Email: angus@phphacks.com 
* Purpose of hack: Basically generates a list of topics and 
* displays them with link to the topic. Goal 
* is to provide search engines like Google 
* with a static page of links to dynamic pages 
* You should link to this page from your sites 
* home page somewhere. 
* Demo: http://www.aussiecelebs.com/forums/site_map.php 
* Tested on: phpBB 2.01, 2.02 
* 
***************************************************************************/ 

/*************************************************************************** 
* 
* This program is free software; you can redistribute it and/or modify 
* it under the terms of the GNU General Public License as published by 
* the Free Software Foundation; either version 2 of the License, or 
* (at your option) any later version. 
* 
***************************************************************************/ 

echo " 

"; 

define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

echo "<h2>Beiträge</h2>"; 

$result = mysql_query("SELECT topic_title, topic_id FROM phpbb_topics ORDER BY topic_title"); 
while($row= mysql_fetch_assoc($result)) 

{     $topicId = $row["topic_id"] ; 
     $result_post = mysql_query("SELECT pt.post_text FROM " . POSTS_TABLE . " p," . POSTS_TEXT_TABLE . " pt WHERE p.post_id = pt.post_id AND p.topic_id = '$topicId' LIMIT 500") ; 
      $row_post =  mysql_fetch_assoc($result_post) ; 
     $post = $row_post["post_text"] ; 
      $post = preg_replace("/\[.*\]/"," ... ",$post);  // $post = preg_replace("/\[url(.*)?\](.*)\[\/url\]/"," xxx\\2xxx ",$post); 
     $zufall=rand(222,360); 
      $post = substr($post,0,$zufall) ; 
      $post = preg_replace ("/ [^ ]+$/","",$post) ; 
     echo "<br><a href='viewtopic.php?t=$topicId'>".$row["topic_title"]."</a> " . $post . " <font size='1'><a href='viewtopic.php?t=$topicId' title='Lesen Sie hier alles zu: " . $row["topic_title"] . "'>mehr</a></font><br>"; 
} 

echo " 

<!-- Start footer here. --> 

</body> 
</html> 

<!-- End footer --> 

"; 

?> 

Verfasst: 26.08.2005 14:47
von austrian-i
1) einfach diese datei raufladen
2) dort wo "2,14,7,9,3,5,12,15,18,19,20,21,22,23,24,25,26" steht (kommt zwei mal vor) - das sind die foren-ids, die nicht in der site map auftauchen. wennst also 10 foren-id's hast, und du möchtest eine foren-id 3 in der sitemap anzeigen, setzt du 1,2,4,5,6,7,8,9,10 ein


Demo

Code: Alles auswählen

<html> 
<head> 
<title>Sitemap: Tod</title> 
<meta name="robots" content="index,follow"> 
      <?php 
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

$sql = "SELECT count(t.topic_id) as total_spider_topics 
        FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
        WHERE f.forum_id = t.forum_id NOT IN(2,14,7,9,3,5,12,15,18,19,20,21,22,23,24,25,26) 
        AND f.auth_view=0"; 
if( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(GENERAL_ERROR, 'Could not query count info', '', __LINE__, __FILE__, $sql); 
} 
if ($countrow = $db->sql_fetchrow($result)) 
{ 
    $total_spider_topics = $countrow['total_spider_topics']; 
} 


if( isset($HTTP_GET_VARS['offset']) || isset($HTTP_POST_VARS['offset']) ) 
{ 
   $offset = ( isset($HTTP_POST_VARS['offset']) ) ? intval($HTTP_POST_VARS['offset']) : intval($HTTP_GET_VARS['offset']); 
} 
else 
{ 
   $offset = 0; 
} 

$sql = "SELECT t.topic_id, t.topic_title 
        FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
        WHERE f.forum_id = t.forum_id NOT IN(2,14,7,9,3,5,12,15,18,19,20,21,22,23,24,25,26) 
        AND f.auth_view=0 
        ORDER BY t.topic_last_post_id DESC 
        LIMIT $offset, 100"; 
if( !($result = $db->sql_query($sql)) ) 
{ 
   message_die(GENERAL_ERROR, 'Could not query topic info', '', __LINE__, __FILE__, $sql); 
} 
while( $topicrow = $db->sql_fetchrow($result)) 
{ 
$thread_id=$topicrow['topic_id']; 
$thread_title=$topicrow['topic_title']; 

// ************************ you might have to change the format of this string to match your URLs. 

$the_string="<a href='/ftopic".$thread_id.".html'>".$thread_title."</a> ".$thread_title."<br>"; 

    echo $the_string; 
} 

$offset = $offset + 100; 
if ( ($total_spider_topics - $offset) > 0 ) 
{ 
   $new_url = '<a href="' . $_SCRIPT_NAME . '?offset=' . $offset . '">Next</a>'; 
    echo $new_url; 
} 

?> 
   <p>&nbsp;</p> 
</body> 
</html> 

Verfasst: 26.08.2005 15:09
von nasenkopf
ich hab es so gemacht wie du es gesagt hast, aber es funktioniert nicht bei mir.
woran kann das liegen?

Verfasst: 26.08.2005 15:20
von austrian-i
schick mal den link zu deiner site und zur sitemap

Verfasst: 26.08.2005 16:05
von nasenkopf
geht es nicht, dass ich einfach meine bestehende Sitemap behalten kann?
Würde sie nämlich gern beibehalten.
Kann man sie vielleicht nicht ein wenig modifizieren?

Verfasst: 27.08.2005 20:01
von nasenkopf
hat jemand noch eine andere Sitemap oder kann helfen?
danke