forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: zom on March 02, 2008, 04:01:23 pm

Title: Menu with all albums
Post by: zom on March 02, 2008, 04:01:23 pm
Hello I would like to display a page with a menu that will display a list, and link, to all the albums (without thumbnails) listed by alphabetic order.

only the part of code to require by php/mysql all albums will be enough for me and I would integrate it in a specific page.

I ve searched in the topic but didn't find answer to that question.


Thank you for help and part of code.
Title: Re: Menu with all albums
Post by: Nibbler on March 02, 2008, 04:09:04 pm
Code: [Select]
$result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title");

while ($album = mysql_fetch_assoc($result)){
echo '<p><a href="thumbnails.php?album=' . $album['aid'] . '">' . $album['title'] . '</a></p>';
}
Title: Re: Menu with all albums
Post by: Hassan on March 06, 2008, 01:10:38 pm
Nibbler, some more information would be helpful for people like me with lesser knowledge in PHP. :)
Title: Re: Menu with all albums
Post by: Garry2k8 on September 03, 2008, 02:59:29 pm
I now this is an old topic but this is based on this request.
I’m using a separated menu for an introduction page and works well, with one nasty thing; this code doesn’t respect private albums.


My code,

Code: [Select]

<body STYLE="background-color:transparent">

<style type="text/css">
.boxmenu {
margin: 0px;
text-align: left;
padding: 5px 5px 5px 5px;
font-size: 13px;
line-height: 1.2;
color: #999999;
}
.boxmenu-menu a {
display: block;
margin-left: 0px;
margin-top: 2px;
margin-right: 0px;
margin-bottom: 2px;
font-size: 13px;
font-weight: bold;
font-family: "Microsoft Sans Serif";
}
.boxmenu-menu a:link, .boxmenu-menu a:visited, .boxmenu-menu a:active {
color: #ffffff;
text-decoration: none;
}
.boxmenu-menu a:hover {
color: #ffffff;
text-decoration: none;
  background-image: url(themes/anime/images/iframebg.png);
}

</style>
<div class="boxmenu">
<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');
if (
IN_COPPERMINE) {
$path=$CONFIG['site_url'];
} else {
$path 'http://www.mysite.com/coppermine-paint/'//change this to your specific path to make the output url's absolute with trailing slash
}
if (
$FORBIDDEN_SET != ""$FORBIDDEN_SET "AND $FORBIDDEN_SET";
$result mysql_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title");
$album mysql_fetch_array($result);
while (
$album mysql_fetch_assoc($result))
{
echo 
"<div class='boxmenu-menu'><a href=".$path."thumbnails.php?album=".$album['aid']." target='_parent'>*" $album['title'] . "</div></a>";
}
?>

</div>
</body>


This php file is placed in the main map of Coppermine named albums-menu_flow.php.
To put it in an html file with iframe
 
Code: [Select]
<iframe name="iFrame1" width="271" height="309" src="http://www.mysite.com/coppermine-paint/albums-menu_flow.php" scrolling="no" frameborder="0" ALLOWTRANSPARENCY="true"></iframe>

I have used this menu for two Coppermine albums to separate the paintings and photo albums.
My image sample sees here,,
http://i89.photobucket.com/albums/k209/Estherdogs/Snap2.jpg [Edit gauGau] Replaced hotlinked image with attachment [/Edit]

As you can see, the folder my private map is also seen in the menu, in Coppermine it's set on private.
So my question is how to fix this code to respect private albums.
Title: Re: Menu with all albums
Post by: Nibbler on September 03, 2008, 03:04:30 pm
Change the query to

Code: [Select]
$result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility = 0 ORDER BY title");
Title: Re: Menu with all albums
Post by: Garry2k8 on September 03, 2008, 03:11:35 pm
Wow, that’s a fast solve, its okay now, THANKS!