Mod_rewrite für Sitemap

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
tiger87
Mitglied
Beiträge: 169
Registriert: 05.11.2004 15:29

Mod_rewrite für Sitemap

Beitrag von tiger87 »

Wie kann ich den Link viewtopic.php?t=".$topic['topic_id'] in den passenden short url link umwandeln?

Habe folgende Sitemap:

Code: Alles auswählen

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

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

/***************************************************************************
* Save this file as:   sitemap.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.
*
***************************************************************************/
?>
<html>
<head>
<meta http-equiv="content-language" content="de">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Forum :: Sitemap</title>
<meta name="keywords" content="...">
<meta name="description" content="...">
</head>
<?php

echo "<h3>Alle Forum Beiträge</h3>";

$sql = "SELECT t.topic_id FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
    WHERE
        t.forum_id = f.forum_id AND f.auth_view = " . AUTH_ALL . " AND p.topic_id = t.topic_id AND p.post_id = t.topic_last_post_id ORDER BY p.post_time DESC";

$topicscount_query = $db->sql_query($sql);
$row_count = $db->sql_numrows($topicscount_query);
$max_count = $row_count/100;

if($HTTP_GET_VARS[next]>0 && $HTTP_GET_VARS[next]<=$max_count) {
    $next = $HTTP_GET_VARS[next];
}else {
    $next=0;
}


// SQL statement to fetch active topics of public forums
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id
    FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f
    WHERE
        t.forum_id = f.forum_id
            AND f.auth_view = " . AUTH_ALL . "
            AND p.topic_id = t.topic_id
            AND p.post_id = t.topic_last_post_id
    ORDER BY p.post_time DESC  LIMIT ".($next*100).",100";
$topics_query = $db->sql_query($sql);

if ( !$topics_query )
{
    message_die(GENERAL_ERROR, "Could not query list of active topics", "", __LINE__, __FILE__, $sql);
}
else if ( !$db->sql_numrows($topics_query) )
{
    message_die(GENERAL_MESSAGE, $lang['No_match']);
}
else
{
    while ($topic = $db->sql_fetchrow($topics_query))
    {
        echo "<a href='" . append_sid("viewtopic.php?t=".$topic['topic_id'])."'>".$topic["topic_title"]."</a><br>\n";
    }
}



echo "
<BR><BR>
[
";

for($ii=0; $ii<$max_count; $ii++) {
    if($ii+1<$max_count) {
        if($ii==$next) {
            echo("<A>&nbsp;".($ii+1)."&nbsp;|</A>");         
        }else{
            echo("<A HREF='" . append_sid("sitemap".($ii)).".html'>&nbsp;".($ii+1)."&nbsp;|</A>");
        }
    }else{
        if($ii==$next) {
            echo("<A>&nbsp;".($ii+1)."&nbsp;</A>");         
        }else{
            echo("<A HREF='" . append_sid("sitemap".($ii)).".html'>&nbsp;".($ii+1)."&nbsp;</A>");
        }
    }    
}

echo "
]
</body>
</html>
";
?>
Benutzeravatar
FatFreddy
Mitglied
Beiträge: 1937
Registriert: 25.07.2004 15:52
Kontaktdaten:

Beitrag von FatFreddy »

Ich weiß nicht, nach welchem Muster Du die Short-Urls schreiben läßt, aber vom Prinzip funktioniert es wie folgt.

suche:

Code: Alles auswählen

        echo "<a href='" . append_sid("viewtopic.php?t=".$topic['topic_id'])."'>".$topic["topic_title"]."</a><br>\n"; 
ersetze durch:

Code: Alles auswählen

        echo "<a href='" . append_sid("about".$topic['topic_id']).".html'>".$topic["topic_title"]."</a><br>\n";

wobei Du das "about" durch das bei Dir gültige Prefix ersetzen mußt.

Gruß

FatFreddy
Watch out where the huskies go, don't you eat the yellow snow...
Mehr dazu im Reiseforum InselTalk.de.
Tupperdosensucher schauen ins Geocachingforum.
tiger87
Mitglied
Beiträge: 169
Registriert: 05.11.2004 15:29

Beitrag von tiger87 »

Noch ne Frage :)

hab in meiner mod rewrite folgendes stehen:

<files archive>
ForceType application/x-httpd-php
</files>

geht aber nicht :(

Kann man das irgendwie umschreiben? oder ist das was falsch?
Benutzeravatar
FatFreddy
Mitglied
Beiträge: 1937
Registriert: 25.07.2004 15:52
Kontaktdaten:

Beitrag von FatFreddy »

tiger87 hat geschrieben:Noch ne Frage
Ist die erste denn beantwortet?

Dein neues Problem hat aber nichts mit der Sitemap zu tun, oder?

Ich vermute: phpbb Search engine Indexer

Sorry, gleiches Problem hat mich verleitet, 20 Topicseiten auf phpbb.com zu lesen. Ich hab das Ding nie zum Laufen gebracht. :evil:

Wäre schön, wenn jemand eine Lösung hätte.


FatFreddy
Watch out where the huskies go, don't you eat the yellow snow...
Mehr dazu im Reiseforum InselTalk.de.
Tupperdosensucher schauen ins Geocachingforum.
tiger87
Mitglied
Beiträge: 169
Registriert: 05.11.2004 15:29

Beitrag von tiger87 »

Jo danke erste Problem wurde gelöst aber das zweie leider nocht nicht :(
Antworten

Zurück zu „phpBB 2.0: Mod Support“