forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Statistics => Topic started by: fotofreek on March 09, 2004, 10:31:37 am
-
As sort of a 'table of contents' it would be nice to have one page that has links to each photo that is in the database. Because thumbnails would load too slow, textlinks would do like:
<a href="#URL to single photo page#>#photo-title#</a>
Is this done before?
If not, I am willing to do some work myself. I am a programmer, but not in PHP :( so some hints to create a link like this would be great.
fotofreek
-
this hasn't been done yet; your work'd be appreciated. Take a look at the existing code, should give you an idea how to accomplish this...
GauGau
-
I already have it running; it took me less than an hour without having any PHP knowledge before. CPG is so well designed and programmed that it is quite easy to find the examples needed to build new functionality!
You can see it running:
http://www.victorbos.nl/photoindex.php
One of the reasons I wanted this is to make it easy for google to index all photos and their descriptions and keywords, so I added both to the table.
Here is the code:
<?php
define('IN_COPPERMINE', true);
require('include/init.inc.php');
pageheader(Fotoindex);
// 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);
while ($row = mysql_fetch_array($result))
{
if ($row[aid] != $p_aid) {
echo "<tr><td class=\"tableh2\" colspan = \"3\">$row[atitle]</td></tr>" ;
}
// weer geef de data
echo "<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>";
$p_aid = $row[aid] ;
} ; // while
endtable();
pagefooter();
?>
greets,
fotofreek
-
Updated the code above today, to fix a potential problem with the links.
fotofreek.
-
Heh, thats a cool mod.. my only problem is that with 27,000 pics, even text links take a little time to load :D :D
Wonder if it could be split up into pages?
(heh and as an aside, would be interesting if there was some way of making more of the gallery more search engine friendly.. A lot of spiders don't bother with something.php?id=4 and something.php?id=5, which is annoying)
-
I've got this mod running here:
http://www.defencetalk.com/pictures/photoindex.php
How can I also have ALBUM names linked as well?
Thanks!
-
Great! Works for me. Thank you.
-
Nice work for a programmer ;) working great, would be better if I actually named all the fotos :-\\
snork13
http://gallery.snork13.net/fotoindex.php
-
How would I get this for every album & on the main gallery page ???
Any help would be great.
Regards, will ;D
-
Mornin',
This topic and MOD in French board too (http://forum.coppermine-gallery.net/index.php?topic=34706.0). Thanx to fofofreek ;D
PYAP
-
seems weird, but on my gallery it only gives a blank page!
see http://www.daviderenda.com/sitemap.php
-
to respect private albums the query should be modified as follows
$album_filter = '';
if($FORBIDDEN_SET){
$album_filter = ' and ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
}
$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 $album_filter order by a.aid, a.pid desc");
-
seems weird, but on my gallery it only gives a blank page!
see http://www.daviderenda.com/sitemap.php
I'd say you're galley has to many pics to hold all the data or php mem per session isn't enough.
Solution: Introduce pagination (some limit, if it's more pics then start a new site)
Test this with adding eg. LIMIT 100 to the query
... desc LIMIT 100");
-
That's really nice mod, but I cant get it worked on my site.
http://forums.racingvideoz.com/gallery/sitemap.php
Can someone help me? ???
Thanks
-
Try changing
mysql_query
to
cpg_db_query
;)