forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: 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.
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 = -1 ;
// Result to table
starttable("100%", Fotoindex, 3);
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%", Fotoindex, 3);
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 :)
-
Neat idea.
How about a link to your site so we can take a peek?
-
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.
-
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.
-
Sorry, I forgot to do this.
-
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
-
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?
-
Post in English!