Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 01:21 pm EDT

Geeklog Forums

Site Map


Status: offline

RickW

Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Has anybody created a routine/hack/plugin that automatically generates a site map?
www.antisource.com
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Tom Willet wrote a site index script, which at least comes close. Should be available over at GPlugs.

bye, Dirk
 Quote

Status: offline

mrb42

Forum User
Junior
Registered: 10/15/04
Posts: 20
The site index there just does the stories, if you'd like to add the links/events/polls/static pages it can be done... I combined a set of index pages I found... figured I'd post it here.

Text Formatted Code

<?php
// +---------------------------------------------------------------------------+
// | siteindex.php                                                            |
// | This is a event index page made especially for googlebots.                |
// +---------------------------------------------------------------------------|
// | Copyright (C) 2002 by the following authors:                              |
// | Tom Willett                 -    twillett@users.sourceforge.net           |
// | Lee Whitworth               -    lwhitworth@users.sourceforge.net         |
// +---------------------------------------------------------------------------|
// | 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.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software               |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA|
// |                                                                           |
// +---------------------------------------------------------------------------|
require_once('lib-common.php');


$perpage = 75;

$display = COM_siteHeader('none');

$display .= '<h1>Site Index</h1>';

$sql = "SELECT *,unix_timestamp(date) AS day FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
$sql .= " AND (";
if (!empty ($_USER['uid'])) {
    $groupList = '';
    foreach ($_GROUPS as $grp) {
        $groupList .= $grp . ',';
    }
    $groupList = substr ($groupList, 0, -1);
    $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $sql .= "(perm_members >= 2) OR ";
}
$sql .= "(perm_anon >= 2))";

if (empty($page)) {
   
    $page = 1;
}

$offset = ($page -1) * $perpage;

$order = " ORDER BY sid DESC LIMIT $offset, $perpage";

$recs = DB_query($sql . $order);
$nrows = DB_numRows($recs);

$display .= '<table width="100%"><tr><td>Date</td><td>Topic</td><td>Title</td></tr>';

for ($x = 0; $x < $nrows; $x++) {
    $A = DB_fetchArray($recs);
    $display .= '<tr><td>' . $A['date'] . '</td>';
    $display .= '<td>' . $A['tid'] . '</td>';
    $display .= '<td>';
    $display .= '<a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid'] . '">'
             . stripslashes($A['title']) . '</a>';
    $display .='</td></tr>';    

}
                           
$display .= '</table><p>';

$countsql = "SELECT count(*) as count FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
$countsql .= " AND (";
if (!empty ($_USER['uid'])) {
   
    $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $countsql .= "(perm_members >= 2) OR ";
}
$countsql .= "(perm_anon >= 2))";

$data = DB_query($countsql);
$D = DB_fetchArray($data);
$num_pages = ceil($D['count'] / $perpage);

$base_url = $_CONF['site_url'] . '/siteindex.php';
$display .= COM_printPageNavigation($base_url,$page, $num_pages);
$display .= '</p>';

// +---------------------------------------------------------------------------+
// | eventindex.php                                                            |
// | This is a event index page made especially for googlebots.                |
// +---------------------------------------------------------------------------|
// | Copyright (C) 2002 by the following authors:                              |
// | Tom Willett                 -    twillett@users.sourceforge.net           |
// | Lee Whitworth               -    lwhitworth@users.sourceforge.net         |
// +---------------------------------------------------------------------------|
// | 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.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software               |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA|
// |                                                                           |
// +---------------------------------------------------------------------------|

$display .= '<h1>Event Index</h1>';

$sql = "SELECT *,unix_timestamp(eid) AS day FROM {$_TABLES['events']} WHERE (datestart >= NOW())";
$sql .= " AND (";
if (!empty ($_USER['uid'])) {
    $groupList = '';
    foreach ($_GROUPS as $grp) {
        $groupList .= $grp . ',';
    }
    $groupList = substr ($groupList, 0, -1);
    $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $sql .= "(perm_members >= 2) OR ";
}
$sql .= "(perm_anon >= 2))";

if (empty($page)) {
    // If no page sent then assume the first.
    $page = 1;
}

$offset = ($page -1) * $perpage;

$order = " ORDER BY eid DESC LIMIT $offset, $perpage";

$recs = DB_query($sql . $order);
$nrows = DB_numRows($recs);

$display .= '<table width="100%"><tr><td><b>EID</b></td><td><b>Title</b></td><td><b>Type</b></td><td><b>Start</b></td><td><b>End</b></td></tr>';

for ($x = 0; $x < $nrows; $x++) {
    $A = DB_fetchArray($recs);
    $display .= '<tr><td>' . $A['eid'] . '</td>';
    $display .= '<td>';
    $display .= '<a href="' . $_CONF['site_url'] . '/calendar_event.php?mode=&eid=' . $A['eid'] . '">'
             . stripslashes($A['title']) . '</a>';
        $display .= '</td>' . '<td>' . $A['event_type'] . '</td>';
    $display .= '<td>' . $A['datestart'] . '<br>' . $A['timestart'] . '</td>';
        $display .= '<td>' . $A['dateend'] . '<br>' . $A['timeend'] . '</td></tr>';
}
                           
$display .= '</table><p>';

$countsql = "SELECT count(*) as count FROM {$_TABLES['events']} WHERE (datestart >= NOW())";
$countsql .= " AND (";
if (!empty ($_USER['uid'])) {
    // Note: $groupList re-used from above
    $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $countsql .= "(perm_members >= 2) OR ";
}
$countsql .= "(perm_anon >= 2))";

$data = DB_query($countsql);
$D = DB_fetchArray($data);
$num_pages = ceil($D['count'] / $perpage);

 // Print Google-like paging navigation
$base_url = $_CONF['site_url'] . '/eventindex.php';
$display .= COM_printPageNavigation($base_url,$page, $num_pages);
$display .= '</p>';

// +---------------------------------------------------------------------------+
// | linkindex.php                                                             |
// | This is a link index page made especially for googlebots.                 |
// +---------------------------------------------------------------------------|
// | Copyright (C) 2002 by the following authors:                              |
// | Tom Willett                 -    twillett@users.sourceforge.net           |
// | Lee Whitworth               -    lwhitworth@users.sourceforge.net         |
// +---------------------------------------------------------------------------|
// | 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.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software               |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA|
// |                                                                           |
// +---------------------------------------------------------------------------|

$display .= '<h1>Link Index</h1>';

$sql = "SELECT *,unix_timestamp(date) AS day FROM {$_TABLES['links']} WHERE (date <= NOW())";
$sql .= " AND (";
if (!empty ($_USER['uid'])) {
    $groupList = '';
    foreach ($_GROUPS as $grp) {
        $groupList .= $grp . ',';
    }
    $groupList = substr ($groupList, 0, -1);
    $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $sql .= "(perm_members >= 2) OR ";
}
$sql .= "(perm_anon >= 2))";

if (empty($page)) {
    // If no page sent then assume the first.
    $page = 1;
}

$offset = ($page -1) * $perpage;

$order = " ORDER BY lid DESC LIMIT $offset, $perpage";

$recs = DB_query($sql . $order);
$nrows = DB_numRows($recs);

$display .= '<table width="100%"><tr><td><b>Date</b></td><td><b>Title</b></td><td><b>Link</b></td><td><b>Hits</b></td></tr>';

for ($x = 0; $x < $nrows; $x++) {
    $A = DB_fetchArray($recs);
    $display .= '<tr><td>' . $A['date'] . '</td>';
    $display .= '<td>' . $A['title'] . '</td>';
    $display .= '<td>';
    $display .= '<a href="' . $_CONF['site_url'] . '/portal.php?what=link&item=' . $A['lid'] . '">'
             . $A['url'] . '</a>';
    $display .='</td>' . '<td>' . $A['hits'] . '</td></tr>';    

}
                           
$display .= '</table><p>';

$countsql = "SELECT count(*) as count FROM {$_TABLES['links']} WHERE (date <= NOW())";
$countsql .= " AND (";
if (!empty ($_USER['uid'])) {
    // Note: $groupList re-used from above
    $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $countsql .= "(perm_members >= 2) OR ";
}
$countsql .= "(perm_anon >= 2))";

$data = DB_query($countsql);
$D = DB_fetchArray($data);
$num_pages = ceil($D['count'] / $perpage);

 // Print Google-like paging navigation
$base_url = $_CONF['site_url'] . '/linkindex.php';
$display .= COM_printPageNavigation($base_url,$page, $num_pages);
$display .= '</p>';

// +---------------------------------------------------------------------------+
// | pageindex.php                                                             |
// | This is a index page for Tom's Staticpages 1.2 made especially for        |
// | googlebots. Only works with Staticpages 1.2!                              |
// +---------------------------------------------------------------------------|
// | Copyright (C) 2002 by the following authors:                              |
// | Tom Willett                 -    twillett@users.sourceforge.net           |
// | Lee Whitworth                               -    lwhitworth@users.sourceforge.net         |
// +---------------------------------------------------------------------------|
// | 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.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software               |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA|
// |                                                                           |
// +---------------------------------------------------------------------------|

$display .= '<div align="center"><p><h1>Page Index<h1></div>';

$sql = "SELECT *,unix_timestamp(sp_date) AS day FROM {$_TABLES['staticpage']} WHERE (sp_date <= NOW())";
$sql .= " AND (";
if (!empty ($_USER['uid'])) {
    $groupList = '';
    foreach ($_GROUPS as $grp) {
        $groupList .= $grp . ',';
    }
    $groupList = substr ($groupList, 0, -1);
    $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $sql .= "(perm_members >= 2) OR ";
}
$sql .= "(perm_anon >= 2))";

if (empty($page)) {
    // If no page sent then assume the first.
    $page = 1;
}

$offset = ($page -1) * $perpage;

$order = " ORDER BY sp_id DESC LIMIT $offset, $perpage";

$recs = DB_query($sql . $order);
$nrows = DB_numRows($recs);

$display .= '<table width="100%"><tr><td><b>Date</b></td><td><b>Label</b></td><td><b>Title</b></td><td><b>Views</b></td></tr>';

for ($x = 0; $x < $nrows; $x++) {
    $A = DB_fetchArray($recs);
    $display .= '<tr><td>' . $A['sp_date'] . '</td>';
    $display .= '<td>' . $A['sp_label'] . '</td>';
    $display .= '<td>';
    $display .= '<a href="' . $_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id'] . '">'
             . stripslashes($A['sp_title']) . '</a>';
    $display .='</td>' . '<td>' . $A['sp_hits'] . '</td></tr>';    

}
                           
$display .= '</table><p>';

$countsql = "SELECT count(*) as count FROM {$_TABLES['staticpage']} WHERE (sp_date <= NOW())";
$countsql .= " AND (";
if (!empty ($_USER['uid'])) {
    // Note: $groupList re-used from above
    $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $countsql .= "(perm_members >= 2) OR ";
}
$countsql .= "(perm_anon >= 2))";

$data = DB_query($countsql);
$D = DB_fetchArray($data);
$num_pages = ceil($D['count'] / $perpage);

 // Print Google-like paging navigation
$base_url = $_CONF['site_url'] . '/pageindex.php';
$display .= COM_printPageNavigation($base_url,$page, $num_pages);
$display .= '</p>';

// +---------------------------------------------------------------------------+
// | voteindex.php                                                             |
// | This is a poll index page made especially for googlebots.                 |
// +---------------------------------------------------------------------------|
// | Copyright (C) 2002 by the following authors:                              |
// | Tom Willett                 -    twillett@users.sourceforge.net           |
// | Lee Whitworth               -    lwhitworth@users.sourceforge.net         |
// +---------------------------------------------------------------------------|
// | 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.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software               |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA|
// |                                                                           |
// +---------------------------------------------------------------------------|

$display .= '<h1>Poll Index</h1>';

$sql = "SELECT *,unix_timestamp(date) AS day FROM {$_TABLES['pollquestions']} WHERE (date <= NOW())";
$sql .= " AND (";
if (!empty ($_USER['uid'])) {
    $groupList = '';
    foreach ($_GROUPS as $grp) {
        $groupList .= $grp . ',';
    }
    $groupList = substr ($groupList, 0, -1);
    $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $sql .= "(perm_members >= 2) OR ";
}
$sql .= "(perm_anon >= 2))";

if (empty($page)) {
    // If no page sent then assume the first.
    $page = 1;
}

$offset = ($page -1) * $perpage;

$order = " ORDER BY date DESC LIMIT $offset, $perpage";

$recs = DB_query($sql . $order);
$nrows = DB_numRows($recs);

$display .= '<table width="100%"><tr><td><b>Date</b></td><td><b>Question</b></td><td><b>Votes</b></td></tr>';

for ($x = 0; $x < $nrows; $x++) {
    $A = DB_fetchArray($recs);
    $display .= '<tr><td>' . $A['date'] . '</td>';
    $display .= '<td>';
    $display .= '<a href="' . $_CONF['site_url'] . '/pollbooth.php?qid=' . $A['qid'] . '">'
             . $A['question'] . '</a>';
    $display .='</td>' . '<td>' . $A['voters'] . '</td></tr>';
}
                           
$display .= '</table><p>';

$countsql = "SELECT count(*) as count FROM {$_TABLES['pollquestions']} WHERE (date <= NOW())";
$countsql .= " AND (";
if (!empty ($_USER['uid'])) {
    // Note: $groupList re-used from above
    $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
    $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
    $countsql .= "(perm_members >= 2) OR ";
}
$countsql .= "(perm_anon >= 2))";

$data = DB_query($countsql);
$D = DB_fetchArray($data);
$num_pages = ceil($D['count'] / $perpage);

 // Print Google-like paging navigation
$base_url = $_CONF['site_url'] . '/voteindex.php';
$display .= COM_printPageNavigation($base_url,$page, $num_pages);
$display .= '</p>';

$display .= COM_siteFooter();
echo $display;
?>


 


Enjoy!
-Mark
 Quote

techuser

Anonymous
awake
Hi,

Where do you put these files and how do I run them?

Thanks for your help Smile
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The above code goes into a new file, e.g. siteindex.php, that you'll save in your public_html. You'll need to add a link to it from somewhere, e.g. from the footer or a side block.

bye, Dirk
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
Im receiving the following error with the above site map:
2 - Cannot modify header information - headers already sent by (output started at /var/www/web58/html/siteindex.php:2) @ /var/www/web58/html/bad_behavior2/bad-behavior/screener.inc.php line 8
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
I'm not sure why bad-behavior is complaining but I do believe this siteindex code does need some updating to work with the current version of Geeklog. I still use this so if you want I can upload my modified version to Geeklog?
One of the Geeklog Core Developers.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
Thank you, yes, I think many people would like a sitemap as permanent feature
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
I'll submit it then.

This is actually something that I have on my to do list. Is create a sitemap plugin that is also compatiable witth the Google sitemap format. There is a google sitemap generator plugin already but I believe you do need to hack Geeklog to make it work and it has a few other issues that need improvements.


One of the Geeklog Core Developers.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: Laugh

There is a google sitemap generator plugin already but I believe you do need to hack Geeklog to make it work and it has a few other issues that need improvements.


A much improved version of that plugin is on its way, so don't waste your time Mr. Green

bye, Dirk
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
That is good news,

Who is doing it?
One of the Geeklog Core Developers.
 Quote

All times are EDT. The time is now 01:21 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content