Depth of Sub-Album Tree on Main Page

whiti

Joined: 2002-10-13
Posts: 1
Posted: Sun, 2002-10-13 01:37

Hi,
is it possible to set the depth of the Sub-Album Tree (showAlbumTree = "yes"), so it on doesn't show the Sub-Albums of the Sub-Albums and so on. I want gallery to show only one level of Sub-Albums and not the level below that.

thx
Max

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Wed, 2002-12-11 13:26

has this been answered, I'm sitting here scoping the this whole section and noticed this. it was something I was wondering about too

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Wed, 2002-12-11 23:57

I just made this up, and didn't test it, so let me know how it goes:

In util.php edit printChildren() as follows:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
function printChildren($albumName, $levels, $depth=0) {
...
if ($levels) {
for ($i=1; $i <= $numPhotos; $i++) {
...
printChildren($myname, $levels-1, $depth+1);
...
}
}
}
</TD></TR></TABLE><!-- BBCode End -->

Then in albums.php, change the line to:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
<?php echo printChildren($albumName, LEVELS); ?>
</TD></TR></TABLE><!-- BBCode End -->

where LEVELS is the number of levels you want. Note that this won't work now without specifiying a specific number of levels.

-Beckett (

)

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Thu, 2002-12-12 00:45

Ok, my entire subalbum tree disappeared.

I added
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
if ($levels) { //this line before where I saw this line below

for ($i=1; $i <= $numPhotos; $i++) {
</TD></TR></TABLE><!-- BBCode End -->

and
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
printChildren($myName,$levels-1,$depth+1); //altered from $myName,$depth+1
</TD></TR></TABLE><!-- BBCode End -->

and then I added a
{

to close off the if ($levels) statment right after the
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
echo "</div>";
</TD></TR></TABLE><!-- BBCode End -->

and in my albums.php, I have:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
<?php echo printChildren($albumName, 1); ?>
</TD></TR></TABLE><!-- BBCode End -->
although I've changed the number to other ones with the same result
http://www.goombalooza.com/gallery/

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Thu, 2002-12-12 01:33

Did you remember to change the very top function line? (You didn't mention that one).

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Thu, 2002-12-12 01:42

You know, I totally overlooked that thinking you were just using that as a pointer where I should start...

It works

Should I ask here or in another thread or wait for G2 for having:
the number of subalbums now next to the album

SubAlbums
Album1 (3 subalbums)
Album2 (2 subalbums)

It's really really not needed right now, just thought of it. This works fine for now so thanks a lot for helping out Beckett

 
pbyjp
pbyjp's picture

Joined: 2002-11-12
Posts: 260
Posted: Mon, 2003-01-13 08:15

Now that rocks... but it would be nice to print the number of sub albums next to it. true...
And while we are at it, has anybody tried to merge that with the drop down nav?
Paul

 
Picolio
Picolio's picture

Joined: 2003-02-02
Posts: 18
Posted: Sun, 2003-02-02 01:35

Thanks very much for this! It works like a charm. I would like to be able to limit the number of sub-albums it displays as some of my main albums will hold quite a few subs but at this time the above code works perfectly.

If anyone wants to see it, I've added it to my new album at http://www.Picolio.com

Thank you!

Deb

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Mon, 2003-02-03 21:41

I posted a patch to the devel mailing list awhile back for variable
sub-album recursion depth. I didn't look that closely at your code,
but you can search through the mailing list archive for it and see if
there is anything I did that you'd like to use.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2004-02-27 07:30
pbyjp wrote:
....And while we are at it, has anybody tried to merge that with the drop down nav?
Paul

Well here is the drop down part:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=64315#64315
Can somebody try it with beckett's code.

Dave