Pages (2): 1 2   
Member
Member
KiddoMono   07-01-2007, 19:35
#1

I know this probably has been asked already somewhere, but I don't seem to find it... (And with the wiki still being down...) Anyway. I would like to list all albums on my image.php page (as text links). How can I do this? I was doing a simple copy/paste code method from the index.php, but it doesn't seem to be working. Any suggestions?

Thx.

Member
Member
KiddoMono   14-01-2007, 14:46
#2

Is it possible that the next_ablum is looking for subalbums now, instead of albums?

Member
Member
simon   21-01-2007, 12:43
#3

I have exactly the same question. I am using a dropdown jump menu for quick links nav menu which is outputted on every page(image.php, index.php and albums.php).

Since updating to latest version 1.0.6 it only outputs the info on index.php.
Anyone tell me whats happened and how to fix it?

I am currently using the following code to print the relevant info which was working perfectly before:

Member
Member
KiddoMono   21-01-2007, 15:24
#4

The weirdest part to me is that I created a new page (of my own) and the album listing is working great on that page. Maybe I can solve it that way...?

Member
Member
KiddoMono   21-01-2007, 15:42
#5

Okay found it.

In the file "template-functions.php" (in the "zen" directory) you can find a function called "next_album" (somewhere around line 311).
The comments say: "If we're already in the album context, this is a sub-albums loop, which, quite simply, changes the source of the album list." So we need to change this again.

Change this part of the code:
if (in_context(ZP_ALBUM)) {
$_zp_albums = $_zp_current_album->getSubAlbums();
} else {
$_zp_albums = $_zp_gallery->getAlbums($_zp_page);
}

To this:
if (in_context(ZP_ALBUM)) {
//$_zp_albums = $_zp_current_album->getSubAlbums();
$_zp_albums = $_zp_gallery->getAlbums($_zp_page);
} else {
$_zp_albums = $_zp_gallery->getAlbums($_zp_page);
}

Member
Member
simon   21-01-2007, 18:31
#6

Thanks kiddomono, that worked for me.

Kudos to you!

Developer
Developer
trisweb   21-01-2007, 19:22
#7

DANGER: That change disables sub-albums.

If you want to loop the root albums, just set the context before calling the function:

`set_context(ZP_INDEX);

while (next_album()):

...

endwhile;

set_context(ZP_ALBUM);`

In the future maybe I'll make this an option of the next_album() function, something like next_album($level=0) for the root, next_album($level=-1) for the current level...

Member
Member
simon   22-01-2007, 00:00
#8

Thanks for your help Tris!

I will make the relevant changes.

Member
Member
KiddoMono   22-01-2007, 22:00
#9

Aha, even better, thx for the help!
(But I didn't need subalbums in this project anyway...)

Member
Member
petter   09-03-2007, 16:01
#10

So, how do I list the subalbums on the image.php page??

Developer
Developer
trisweb   09-03-2007, 19:52
#11

you should just be able to call while(next_album()): like in the album page... I think that'll do it...

Member
Member
petter   26-03-2007, 09:59
#12

I've tried this, but it doesn't work:

`

Member
Member
simon   27-03-2007, 14:20
#13

I used the following in conjuction with a drop down jump menu, which works fine. You can cut away the bits of form etc. -> should give you something which works in context.
`

  Choose a gallery and click Go 
Member
Member
protum   30-05-2007, 23:55
#14

I too am looking to list sub-albums in image.php...but havent had any luck...

I have no trouble listing parent albums in image.php with this code:
`

`

According to trisweb above, this should work to list subalbums in image.php
`

`

But nothing appears--there should be a bunch of subalbums listed.. printAlbumTitle() alone, out of the while loop, manages to print the current subalbum title but i cant get the other subalbums to list.

This doesnt work either.
`

`

It would be great if anyone could point me in the right direction on this. Thanks!

Member
Member
protum   01-06-2007, 19:37
#15

anybody?

also, i'd like to list albums and subalbums on the index.php page

Member
Member
teedog   21-11-2007, 06:37
#16

I too am trying to list in image.php the subalbums of the image's immediate parent album. Not having much like, like protum.

Here's an example:
AlbumB contains SubAlbum1, SubAlbum2, SubAlbum3.
I'm viewing Image5 in SubAlbum3.

I'm trying to make Image5's page show a dropdown menu that lists/links to SubAlbum1, SubAlbum2, SubAlbum3.

Administrator
Administrator
acrylian   21-11-2007, 10:14
#17

Take a look at the function print_album_menu.php that is located in the zp-core/plugins folder of your zenphoto installations. Move the file to your theme's folder and call it in the head with require_once('print_album_menu.php').

That does exactly what you want and works on index, album and image.php and has an option for a drop down menu. How to use it is included in the file as comments.

One drawback: The menu supports currently only one subalbum level. It will be expanded to support to all levels, but that may take a little time.

Member
Member
teedog   22-11-2007, 21:16
#18

Unfortunately printAlbumMenu() outputs a menu of all the albums and subalbums in your gallery it seems. I wish to only list the subalbums that are one level above the image I am viewing.

I will play with it to see if I can modify for my needs. Thanks.

Administrator
Administrator
acrylian   23-11-2007, 10:35
#19

teedog:
I just rediscovered that I once made a function that lists subalbums when you are it's parent album, one of the subalbum or in an image of them. It's more a draft and unfortunatly only supports one subalbum level too (it was made for 1.0.8.2). But maybe it fits your needs, take a look:
`

$option = "count" for image counter behind the subalbum name, "" for no image counter

The parameters are optional if you want specify CSS-IDs to style the menu. You can leave them blank, too.

$id1 = Insert here the ID for the main album menu like this.

$active1 = Insert the ID for the currently active album link

*/

function printSubAlbumMenu($option,$id1,$active1) {

if ($id1 != "") { $id1 = " id='".$id1."'"; }

if ($active1 != "") { $active1 = " id='".$active1."'"; }

// main album query

$sql = "SELECT id, parentid, folder, title FROM ". prefix('albums') ." WHERE parentid is NULL ORDER BY sort_order";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

$number++;

$idnr[$number] = $row['id']; 

$parentid[$number] = $row['parentid']; 

$folder[$number] = $row['folder'];

$title[$number] = $row['title'];

switch($option) {

case "count": 

// count images in the main albums

$sql = "SELECT COUNT(id) FROM ". prefix('images') ." WHERE albumid = $idnr[$number]";

$result2 = query($sql);

$count = mysql_result($result2, 0);

$imagecount[$number] = " (".$count.")";

}

}

// sub album query - possibly these two queries could be done better...

$sql = "SELECT id, parentid, folder, title FROM ". prefix('albums') ." WHERE parentid ORDER BY sort_order";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

$subnumber++;

$subidnr[$subnumber] = $row['id']; 

$subparentid[$subnumber] = $row['parentid']; 

$subfolder[$subnumber] = $row['folder'];

$subtitle[$subnumber] = $row['title'];

switch($option) {

case "count": 

// count images in the subalbums

$sql = "SELECT COUNT(id) FROM ". prefix('images') ." WHERE albumid = $subidnr[$subnumber]";

$result2 = query($sql);

$count2 = mysql_result($result2, 0);

$subimagecount[$subnumber] = " (".$count2.")";

}   

}

// album view: list subalbums in this album

for ($nr = 1;$nr

Member
Member
senne   23-11-2007, 15:37
#20

Your function uses "getIDForAlbum", I think this has to be getAlbumId. Anyways, great function! Exactly what i'm looking for here: http://www.zenphoto.org/support/topic.php?id=1883&replies=7

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.