Download (paFileDB) ve Makale (KB) eklenmiş SEO uyumlu site-haritaları

phpBB için Arama Motoru Optimizasyonu

Download (paFileDB) ve Makale (KB) eklenmiş SEO uyumlu site-haritaları

İleti

butterflyT
14.04.2007, 17:27

Ön not: paFileDB MOD'u kullanmıyorum. O yüzden test edemedim. Kurulum dosyalarına bakarak hangi tabloyu sorgulamam gerektiğini baktım. Yani %95 çalışması gerekiyor. Yine de kullanan biri test ederse sevinirim.

Önce yapmanız gerekenler: - benzer satırlar varsa yapmanıza gerek yoktur -

Kod: Tümünü seç
--- AÇ ---

includes/constants.php

--- BUL ---

?>

--- ÜZERİNE EKLE ---
//
define('KB_ARTICLES_TABLE', $table_prefix.'kb_articles');
define('PA_FILES_TABLE', $table_prefix.'pa_files');
//

--- KAYDET ve KAPA ---


Uyarı: Eğer Google ve Yahoo sitenizin haritasını ziyaret ettiğinde otomatik e-posta almak istiyorsanız googlesitemap.php ve urllist.php dosyalarında " <?php " satırının hemen altındaki satırda " // " işaretlerini kaldırın ve e-postanızı yazın.

Dosyalar phpBB SEO keyword URLs v.2.3.1 ile uyumludur. Eğer v. 2.3.0 kullanıyorsanız lütfen "function make_url_friendly" aktif hale getiriniz. Önündeki ve sonundaki /* ... */ ekleri kaldırınız.

Eğer makale (KB) ve download (paFileDB) MOD'larını kullanmıyorsanız o zaman MOD ile ilgili // Start for [MOD adi] , // End for [MOD adi] arasındaki satıları silebilir ya da ilerde belki kullanırım derseniz /* ... */ ekleri arasına alabilirsiniz.

1- googlesitemap.php
Kod: Tümünü seç
<?php
//mail('e-posta adresiniz', 'Google Sitemaps Bot', 'The Google Sitemap Bot has accessed your sitemap');
/***************************************************************************
*                          googlesitemap.php
*                          -------------------
*   begin                : Saturday, Feb 23, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
***************************************************************************/

/***************************************************************************
*
*   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.
*
***************************************************************************/

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


//-- [+] phpBB SEO keyword URLs ------------------------------------------
//
/*function make_url_friendly($url)
{
   $url = trim($url);
   $url = strtolower($url);

   $find = array('<b>', '</b>');
   $url = str_replace ($find, '', $url);

   $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);

   $find = array(' ', '&quot;', '&amp;', '&', '\r\n', '\n', '/', '\\', '+', '<', '>');
   $url = str_replace ($find, '-', $url);

   $find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
   $url = str_replace ($find, 'e', $url);

   $find = array('í', 'ý', 'ì', 'î', 'ï', 'I', 'Ý', 'Í', 'Ì', 'Î', 'Ï');
   $url = str_replace ($find, 'i', $url);

   $find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
   $url = str_replace ($find, 'o', $url);

   $find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
   $url = str_replace ($find, 'a', $url);

   $find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
   $url = str_replace ($find, 'u', $url);

   $find = array('ç', 'Ç');
   $url = str_replace ($find, 'c', $url);

   $find = array('þ', 'Þ');
   $url = str_replace ($find, 's', $url);

   $find = array('ð', 'Ð');
   $url = str_replace ($find, 'g', $url);

   $find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');

   $repl = array('', '-', '');

   $url = preg_replace ($find, $repl, $url);
   $url = str_replace ('--', '-', $url);

   return $url;
}*/
//
//-- [-] phpBB SEO keyword URLs ------------------------------------------


// Compresss the sitemap with gzip
// this isn't as pretty as the code in page_header.php, but it's simple & it works :)
if(function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
   ob_start(ob_gzhandler);
}

$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;

if(substr($server_url, -1, 1) != "/")
{
   $server_url .= "/";
}

$output = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
$output .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";

// Start for Topics
// Begin Configuration Section
$included_forum_ids = array(); // Herkese acik forumlar
$excluded_forum_ids = array(1, 2, 3); // Gizli forumlar
// End Configuration Section


if ( count($included_forum_ids) > 0 )
{
   $included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')';
}

if ( count($excluded_forum_ids) > 0 )
{
   $excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')';
}

if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) )
{
   $and = 'AND';
}

if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) )
{
   $where = 'WHERE';
}

$sql = "SELECT topic_id, forum_id, topic_title, topic_time, topic_type FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql ORDER BY topic_time DESC";

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $topic_id = $row['topic_id'];
   $topic_title = $row['topic_title'];
   $lastmodified = date('Y-m-d',$row['topic_time']);
   $viewtopic = $server_url . str_replace ('--', '-', make_url_friendly($topic_title) . "-vt" . $topic_id . ".html");
   $priority = ( $row['topic_type'] == POST_STICKY || $row['topic_type'] == POST_ANNOUNCE ) ? '1.0' : '0.5';
   
   $output .= "<url>\n";
   $output .= "\t<loc>$viewtopic</loc>\n";
   $output .= "\t<lastmod>$lastmodified</lastmod>\n";
   $output .= "\t<changefreq>daily</changefreq>\n";
   $output .= "\t<priority>$priority</priority>\n";
   $output .= "</url>\n\n";
}

$db->sql_freeresult($result);
// End for Topics

// Start for Articles
$sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " WHERE approved = 1 ORDER BY article_date DESC";
if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive articles', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $article_id = $row['article_id'];
   $article_title = $row['article_title'];
   $lastmodified = date('Y-m-d',$row['article_date']);
   $viewarticle = $server_url . str_replace ('--', '-', make_url_friendly($article_title) . "-kba" . $article_id . ".html");
   $priority = '1.0';
   
   $output .= "<url>\n";
   $output .= "\t<loc>$viewarticle</loc>\n";
   $output .= "\t<lastmod>$lastmodified</lastmod>\n";
   $output .= "\t<changefreq>monthly</changefreq>\n";
   $output .= "\t<priority>$priority</priority>\n";
   $output .= "</url>\n\n";
}

$db->sql_freeresult($result);
// End for Articles

// Start for Download
$sql = "SELECT * FROM " . PA_FILES_TABLE . " WHERE file_approved = 1 ORDER BY file_time DESC";
if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive download', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $file_id = $row['file_id'];
   $file_name = $row['file_name'];
   $lastmodified = date('Y-m-d',$row['file_time']);
   $viewfile = $server_url . str_replace ('--', '-', make_url_friendly($file_name) . "-df" . $file_id . ".html");
   $priority = '1.0';
   
   $output .= "<url>\n";
   $output .= "\t<loc>$viewfile</loc>\n";
   $output .= "\t<lastmod>$lastmodified</lastmod>\n";
   $output .= "\t<changefreq>monthly</changefreq>\n";
   $output .= "\t<priority>$priority</priority>\n";
   $output .= "</url>\n\n";
}

$db->sql_freeresult($result);
// End for Download

$output .= "</urlset>\n";

header('Content-type: application/xml');
echo $output;
?>


2- sitemap_site.php
Kod: Tümünü seç
<?php
/***************************************************************************
*                          sitemap_site.php
*                          -------------------
*   begin                : Saturday, Feb 23, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
***************************************************************************/

/***************************************************************************
*
*   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.
*
***************************************************************************/


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

// Begin Configuration Section
$included_forum_ids = array(); // sadece bu forumdan al, forum id yazınız  örn:  array(1,3)
$excluded_forum_ids = array(1, 2, 3); // gizli forumlar, forum id yazınız  örn:  array(1,3)
$message_limit = '500';       // kaç link gösterilsin | Konular, makaleler ve dosyalar icin ornek : 500 x 3 = 1500 link
// End Configuration Section

//-- [+] phpBB SEO keyword URLs ------------------------------------------
//
/*function make_url_friendly($url)
{
   $url = trim($url);
   $url = strtolower($url);

   $find = array('<b>', '</b>');
   $url = str_replace ($find, '', $url);

   $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);

   $find = array(' ', '&quot;', '&amp;', '&', '\r\n', '\n', '/', '\\', '+', '<', '>');
   $url = str_replace ($find, '-', $url);

   $find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
   $url = str_replace ($find, 'e', $url);

   $find = array('í', 'y', 'ì', 'î', 'ï', 'I', 'Y', 'Í', 'Ì', 'Î', 'Ï');
   $url = str_replace ($find, 'i', $url);

   $find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
   $url = str_replace ($find, 'o', $url);

   $find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
   $url = str_replace ($find, 'a', $url);

   $find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
   $url = str_replace ($find, 'u', $url);

   $find = array('ç', 'Ç');
   $url = str_replace ($find, 'c', $url);

   $find = array('?', '?');
   $url = str_replace ($find, 's', $url);

   $find = array('?', 'D');
   $url = str_replace ($find, 'g', $url);

   $find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');

   $repl = array('', '-', '');

   $url = preg_replace ($find, $repl, $url);
   $url = str_replace ('--', '-', $url);

   return $url;
}*/
//
//-- [-] phpBB SEO keyword URLs ------------------------------------------


// Compresss the sitemap with gzip
// this isn't as pretty as the code in page_header.php, but it's simple & it works :)
if(function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
   ob_start(ob_gzhandler);
}

$output = "<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=iso-8859-9' />
<meta name='description' content='" . $board_config['site_desc'] . "' />
<meta name='keywords' content='site,iceriginiz,buraya,yazilacak' />
</head>
<body>\n";

$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;

if(substr($server_url, -1, 1) != "/")
{
   $server_url .= "/";
}

// Start for Articles
$sql = "SELECT *
FROM " . KB_ARTICLES_TABLE . " WHERE approved = 1
ORDER BY article_date DESC
LIMIT " . $message_limit;

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive articles', '', __LINE__, __FILE__, $sql);
}

   $output .= "Makaleler<br />\n";
while ( $row = $db->sql_fetchrow($result) )
{
   $viewarticle = $server_url . str_replace ('--', '-', make_url_friendly($row['article_title']) . "-kba" . $row['article_id'] . ".html");
   $output .= "<a href='" . $viewarticle . "'>" . $row['article_title'] . "</a><br />\n";
}
    $output .= "<br />\n";
   
$db->sql_freeresult($result);
// End for Articles

// Start for Downloads
$sql = "SELECT *
FROM " . PA_FILES_TABLE . " WHERE file_approved = 1
ORDER BY file_time DESC
LIMIT " . $message_limit;

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive downloads', '', __LINE__, __FILE__, $sql);
}

   $output .= "Dosyalar<br />\n";
while ( $row = $db->sql_fetchrow($result) )
{
   $viewfile = $server_url . str_replace ('--', '-', make_url_friendly($row['file_name']) . "-df" . $row['file_id'] . ".html");
   $output .= "<a href='" . $viewfile . "'>" . $row['file_name'] . "</a><br />\n";
}
    $output .= "<br />\n";
   
$db->sql_freeresult($result);
// End for Downloads

// Start for Topics
if ( count($included_forum_ids) > 0 )
{
   $included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')';
}

if ( count($excluded_forum_ids) > 0 )
{
   $excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')';
}

if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) )
{
   $and = 'AND';
}

if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) )
{
   $where = 'WHERE';
}

$sql = "SELECT topic_id, topic_title
      FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql
      ORDER BY topic_time DESC
      LIMIT " . $message_limit;

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql);
}

    $output .= "Forum Konuları<br />\n";
while ( $row = $db->sql_fetchrow($result) )
{
   $viewtopic = $server_url . str_replace ('--', '-', make_url_friendly($row['topic_title']) . "-vt" . $row['topic_id'] . ".html");
   $output .= "<a href='" . $viewtopic . "'>" . $row['topic_title'] . "</a><br />\n";
}
    $output .= "<br />\n";
   
$db->sql_freeresult($result);
// End for Topics

$output .= "</body>\n</html>";

echo $output;
?>


3- urllist.php
Kod: Tümünü seç
<?php
//mail('e-posta adresiniz', 'Yahoo Sitemaps Bot', 'The Yahoo Sitemap Bot has accessed your sitemap');
/***************************************************************************
*                          urllist.php
*                          -------------------
*   begin                : Saturday, Feb 23, 2001
*   copyright            : (C) 2001 The phpBB Group
*   email                : support@phpbb.com
*
***************************************************************************/

/***************************************************************************
*
*   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.
*
***************************************************************************/

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


//-- [+] phpBB SEO keyword URLs ------------------------------------------
//
/*function make_url_friendly($url)
{
   $url = trim($url);
   $url = strtolower($url);

   $find = array('<b>', '</b>');
   $url = str_replace ($find, '', $url);

   $url = preg_replace('/<(\/{0,1})img(.*?)(\/{0,1})\>/', 'image', $url);

   $find = array(' ', '&quot;', '&amp;', '&', '\r\n', '\n', '/', '\\', '+', '<', '>');
   $url = str_replace ($find, '-', $url);

   $find = array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê');
   $url = str_replace ($find, 'e', $url);

   $find = array('í', 'ý', 'ì', 'î', 'ï', 'I', 'Ý', 'Í', 'Ì', 'Î', 'Ï');
   $url = str_replace ($find, 'i', $url);

   $find = array('ó', 'ö', 'Ö', 'ò', 'ô', 'Ó', 'Ò', 'Ô');
   $url = str_replace ($find, 'o', $url);

   $find = array('á', 'ä', 'â', 'à', 'â', 'Ä', 'Â', 'Á', 'À', 'Â');
   $url = str_replace ($find, 'a', $url);

   $find = array('ú', 'ü', 'Ü', 'ù', 'û', 'Ú', 'Ù', 'Û');
   $url = str_replace ($find, 'u', $url);

   $find = array('ç', 'Ç');
   $url = str_replace ($find, 'c', $url);

   $find = array('þ', 'Þ');
   $url = str_replace ($find, 's', $url);

   $find = array('ð', 'Ð');
   $url = str_replace ($find, 'g', $url);

   $find = array('/[^a-z0-9\-<>]/', '/[\-]+/', '/<[^>]*>/');

   $repl = array('', '-', '');

   $url = preg_replace ($find, $repl, $url);
   $url = str_replace ('--', '-', $url);

   return $url;
}*/
//
//-- [-] phpBB SEO keyword URLs ------------------------------------------


// Compresss the sitemap with gzip
// this isn't as pretty as the code in page_header.php, but it's simple & it works :)
if(function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
   ob_start(ob_gzhandler);
}

// Begin Configuration Section
$included_forum_ids = array(); // Herkese acik forumlar
$excluded_forum_ids = array(1, 2, 3); // Gizli forumlar
// End Configuration Section

$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;

if(substr($server_url, -1, 1) != "/")
{
   $server_url .= "/";
}

// Start for Topics
if ( count($included_forum_ids) > 0 )
{
   $included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')';
}

if ( count($excluded_forum_ids) > 0 )
{
   $excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')';
}

if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) )
{
   $and = 'AND';
}

if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) )
{
   $where = 'WHERE';
}

$sql = "SELECT topic_id, topic_title, topic_type FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql ORDER BY topic_time DESC";

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $viewtopic = $server_url . str_replace ('--', '-', make_url_friendly($row['topic_title']) . "-vt" . $row['topic_id'] . ".html");
   
   $output .= "$viewtopic\n";
}

$db->sql_freeresult($result);
// End for Topics

// Start for Articles
$sql = "SELECT * FROM " . KB_ARTICLES_TABLE . " WHERE approved = 1 ORDER BY article_date DESC";

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive articles', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $viewarticle = $server_url . str_replace ('--', '-', make_url_friendly($row['article_title']) . "-kba" . $row['article_id'] . ".html");
   
   $output .= "$viewarticle\n";
}

$db->sql_freeresult($result);
// End for Articles

// Start for Downloads
$sql = "SELECT * FROM " . PA_FILES_TABLE . " WHERE file_approved = 1 ORDER BY file_time DESC";

if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Error: could not retrive downloads', '', __LINE__, __FILE__, $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $viewfile = $server_url . str_replace ('--', '-', make_url_friendly($row['file_name']) . "-df" . $row['file_id'] . ".html");
   
   $output .= "$viewfile\n";
}

$db->sql_freeresult($result);
// End for Downloads

header('Content-type: application/txt');
echo $output;
?>
Kullanıcı avatarı
butterflyT
Kıdemli Üye
Kıdemli Üye
 
İleti: 144
Kayıt: 14.12.2005, 18:48

Arama Motoru Optimizasyonu



Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 0 misafir

cron