Get structured list of albums to generate menu?

dschuetz

Joined: 2005-07-19
Posts: 8
Posted: Fri, 2005-08-12 18:21

Here's one I don't think I've seen discussed.

Can I easily:
* Fetch a list of available albums
* Showing only those viewable by me (based on session / userid)
* In a hierarchical structure

I want to take that list and use the first two levels to add items to my default navigation menu. That way, I can have "Gallery -> Travel" or "Gallery -> Travel -> England" in my site menu, just to make it easier to go straight to certain albums and such.

I know I could simply grab the sidebar and parse the "jump to album" block, but that 1) requires that block be displayed, 2) in *just* such a format, and 3) isn't easily parsed in a structured manner.

The alternative is simply that I manually create a menu structure within my CMS, but then every time I add a new album in Gallery I'll have to manually add that in the site menu, and I'd like it to be "magic." :)

Thanks!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-08-12 20:20

so you basically want the album select module block...

 
dschuetz

Joined: 2005-07-19
Posts: 8
Posted: Sat, 2005-08-13 01:10
valiant wrote:
so you basically want the album select module block...

I might...I might. I do admit freely that I'm not as familar with G2 (or even just plain G) as most, but I haven't been able to wade through much of the documentation on embedding and I didn't see anything from a quick search or two of the forums.

On the other hand, if by "album select module block" you mean the bit in the sidebar that shows either a tree or a pop-up list of albums, then, no. I mean, yes, I want the data that builds those blocks, but I don't want to be parsing those blocks per se.

After I posted my initial request, I toyed a little more and came up with a refinement: A simple list of album paths is all I really need. (at least, all I think I need, right now, in my less-than-alert state) (I'm a little distracted by a baby at the moment :) ).

I need a list of album names, something like this:

Travel
Travel/England
Travel/Boston
Home
Home/Improvements
Home/Holidays
....

I can then parse through that list, separating on /, to get the data I need. Coincidentally, the way that I need to add items to the menu is all / based, too -- when I add "Travel/Boston" it automagically makes it a subitem of a menu "Travel." So I just add each string as a menu item, and I use the last component as the menu's title.

Or, better yet, if I start with an array of (path,name) pairs, I can add Album Names instead of paths to the menu.

Ultimately, I want this as part of the main, integrated site menu, not as a sidebar item.

So what's this album select block? Something I can easily call from the menu generation routine in the embedding module? Or is it just some kind of sidebar block?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-08-13 12:08

the final result, in what was does it differ from the album select block that you see on http://www.nei.ch/gallery/ ?

 
dschuetz

Joined: 2005-07-19
Posts: 8
Posted: Sun, 2005-08-14 01:19
valiant wrote:
the final result, in what way does it differ from the album select block that you see on http://www.nei.ch/gallery/ ?

I'm trying to get the gallery more seamlessly integrated into my site. I want the albums to be selected directly from the main site menu, not from a submenu in a sidebar. The idea being that the end user shouldn't know where pages end and the galleries begin.

I've currently got something rough set up here: http://www.dasnet.org/gallery (note that the menus aren't currently remaining highlighted the way they should, and they're acting strangely on Mac Firefox). (and I really don't have anything out there yet as I'm just getting started....)

In the long run, this may not even be a viable approach for me, but it might be for others, especially people who try to have a larger, all-encompassing site menu on the left.

So, I'm guessing that there isn't an easy way to do this, then?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-08-14 11:38

my point is this:

it is planned that you can request any block from g2 with GalleryEmbed.
you'd request the album select dhtml block and you could add your own CSS to make it look a little different. then you're done.

and if you absolutely want to create your own album select thing, feel free to do it.
you'll have to call
GalleryEmbed::init
then you'll have to check modules/albumselect/ on how it creates it's album select block and copy some code.

 
dschuetz

Joined: 2005-07-19
Posts: 8
Posted: Sun, 2005-08-14 12:51
valiant wrote:
it is planned that you can request any block from g2 with GalleryEmbed. you'd request the album select dhtml block and you could add your own CSS to make it look a little different. then you're done.

and if you absolutely want to create your own album select thing, feel free to do it. you'll have to call
GalleryEmbed::init
then you'll have to check modules/albumselect/ on how it creates it's album select block and copy some code.

Ah! Okay, I'm sorry then. I thought you were talking about just using the album select block as, well, a block. but if there's a way to manually call it w/out having it appear, then that might well get me everything I need.

thanks, I'll do some exploring on this...

 
dschuetz

Joined: 2005-07-19
Posts: 8
Posted: Tue, 2005-08-30 19:13

Okay, I've managed to get a list of albums fully integrated into my main site menu. Now I just need to find a call that will give me the current album. That is, for any given page that I'm viewing (list of items, or an item detail view, etc.), I want to know what album I'm in at that point. Then I can set the appropriate menu / breadcrumb within my site menu to match.

I've poked around a bit, but can't figure out where to get that information. I'm guessing something after handle_request like "$item = [whatever]getCurrentAlbum" and then from there I can either access a path, or fetch one based on an album id or something. (yes, I'm being incredibly vague 'cause I don't know what I'll be getting)

Any suggestions where to look? The API documentation really didn't help me any... :(