Sitemap mod with cache Sitemap mod with cache
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Sitemap mod with cache

Started by basisbyte, March 25, 2007, 08:40:59 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

basisbyte

Hello everyone out there. First thing: please forgive my bad english, it's not my mother tongue. If something is confusing I'll try to explain.

I hope that this is the right place, I didn't know where to put it.

I made a quick and dirty hack (very dirty) for this sitemap mod I found -> http://forum.coppermine-gallery.net/index.php?topic=4419.0

My problem was that my gallery contains about 4000 Files and images, and everytime a user opend the sitemap the database had to cycle through this 4000 Entrys.

So I made a quick and dirty hack to write the content to a txt file, with the oppotunity to activate the writing process manually.

Put the following code into a file called sitemap.php and save it in your coppermine root folder:

<?php 
define
('IN_COPPERMINE'true);

require(
'include/init.inc.php');
pageheader(Fotoindex);

$get_vars['sitemap']=$_GET['sitemap'];

if (
$get_vars['sitemap']=="build")
{

// Select all photos
$result mysql_query("SELECT a.pid, a.aid, a.title, a.caption, a.keywords, b.title atitle from {$CONFIG['TABLE_PICTURES']} a, {$CONFIG['TABLE_ALBUMS']} b where a.aid = b.aid order by a.aid, a.pid desc");
if (!
mysql_num_rows($result)) cpg_die(ERROR$lang_errors['non_exist_ap']);

$p_aid = -;

// Result to table
starttable("100%"Fotoindex3);
echo 
"<br>-------------Cache Writer start-------------<br>";
$cache "albums/cache.txt";

$fh fopen($cache'w');


   while (
$row mysql_fetch_array($result)) 
        { 
                if (
$row[aid] != $p_aid) {
$write="<tr><td class=\"tableh2\" colspan = \"3\">$row[atitle]</td></tr>";
fwrite($fh$write);

            }
            
// weer geef de data 
       
$write2="<tr><td><a href=\"displayimage.php?pos=-$row[pid]\" title=\"$row[title]\">$row[title]</a></td><td>$row[caption]</td><td>$row[keywords]</td></tr>";
fwrite($fh$write2);
$p_aid $row[aid] ;
    } ; 
// while
fclose($fh);  
echo 
"<br>-------------Cache Writer finished-------------<br>";            
endtable();
}
else
{
starttable("100%"Fotoindex3);
echo 
"Hello engines";
include 
"albums/cache.txt";

endtable();
}
pagefooter();
?>


Afterwards active the writing process for the first time as described below.

You can active the writing process by putting the following into your browser adress field: path-to-coppermine/sitemap.php?sitemap=build

Afterwards place a link from somewhere on your site to the sitemap.php (without the ?sitemap.php=build ending) and activate the writing process from time to time. (Perhaps @ night when your server load is low).

PS: Thanks to the coppermine team for the superb software. I'm using it for two years now (just updated to 1.4.10), and I love it :)

redham

Neat idea.

How about a link to your site so we can take a peek?

basisbyte

I don't want to place a link now: I just updatet from 1.3.5 to 1.4.10 (which worked like a charme) and I still have to do a lot of work (adding some mods and own stuff which will take some weeks to finish),and I don't want to show my half-done work. I will place a link, once  it's finished.

At the moment I'm adding a little addon to this mod, so that only logged in admins can start the writing process - Perhaps I add a button in the ACP too.

A second mod I'm working on is a kind of a User Blog System, so that registered Users can start a small Multimedia blog right in Gallery. Is this only interesting for my, or would it be useful for other users here too?  I think I'll finish it in one or two month.

Joachim Müller

Quote from: basisbyte on April 04, 2007, 06:35:52 PM
A second mod I'm working on is a kind of a User Blog System, so that registered Users can start a small Multimedia blog right in Gallery. Is this only interesting for my, or would it be useful for other users here too?  I think I'll finish it in one or two month.
Separate issues should go into separate threads. Please respect board rules.

basisbyte


arges

Hey,
How to transform the sitemap.php in sitemap.xml for the google?
I have the sitemap.php works correctly but google only accept in format xml.
thanks

RedPage

Quote from: basisbyte on March 25, 2007, 08:40:59 PM
Hello everyone out there. First thing: please forgive my bad english, it's not my mother tongue. If something is confusing I'll try to explain.

À íà êàêîì ìû áîëòàåì?
À on what we chatter?

Joachim Müller