Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Sitemap mod with cache  (Read 17466 times)

0 Members and 1 Guest are viewing this topic.

basisbyte

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 4
  • I love it to write small and big php scripts..
    • SEO | Online Marketing | PHP Scripts
Sitemap mod with cache
« 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:

Code: [Select]
<?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 :)
« Last Edit: April 04, 2007, 08:49:27 am by GauGau »
Logged

redham

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 1
    • Glitter Host -- Enterprise Class Web Hosting
Re: Sitemap mod with cache
« Reply #1 on: April 04, 2007, 05:44:38 am »

Neat idea.

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

basisbyte

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 4
  • I love it to write small and big php scripts..
    • SEO | Online Marketing | PHP Scripts
Re: Sitemap mod with cache
« Reply #2 on: April 04, 2007, 06:35:52 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Sitemap mod with cache
« Reply #3 on: April 04, 2007, 08:56:36 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.
Logged

basisbyte

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 4
  • I love it to write small and big php scripts..
    • SEO | Online Marketing | PHP Scripts
Re: Sitemap mod with cache
« Reply #4 on: April 04, 2007, 09:26:25 pm »

Sorry, I forgot to do this.
Logged

arges

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 11
  • Learning with the bests!
Re: Sitemap mod with cache
« Reply #5 on: April 27, 2007, 09:56:55 pm »

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
Logged

RedPage

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 82
  • Doping
    • Ýñêèçû òàòóèðîâîê.
Re: Sitemap mod with cache
« Reply #6 on: November 19, 2007, 03:00:27 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?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Sitemap mod with cache
« Reply #7 on: November 19, 2007, 06:58:44 pm »

Post in English!
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.