Hi, I'm guessing this has been discussed already, but I just can't find it (probably not searching for the right thing). I am trying to give some albums a specific view which will pull in specific data from a mapped set of DB tables which I created in a module. I am trying to avoid the complexities of creating a derivative of GalleryAlbumItem (mostly 'cause i'm even MORE lost there than with this) so I'm just looking to pass a set of variables to the modified album tpl file. Therein lies my problem, I can't find where all the album data is pulled in (the children, the album information, etc). Could someone please direct me to the right files? Or is there a more appropriate way of doing this? I understand that this is best done with a derivative of the GalleryAlbumItem and it'll contain images, and pull in additional information about the derivative from another table .... but I can't find anything in the Docs to help me figure out how to Do that.
Thanks to anyone to can offer a few breadcrumbs for me to follow to the answer, many many thanks for anything that can help me out a bit. I am totally lost in this huge wonderful forrest of Gallery2
-Alex G
Posts: 4342
Lots of ways of doing this. The best ones will avoid hacking any core files.
The easiest way is to code a callback in your new module; the callback is called from your modified album.tpl, loads the extra information that you want from a Map (gallery table) and sends the info back to the template which displays it. Very standard G2 technique. Yawnworthy, in fact, which from your point of view is a Very Good Thing.
If you don't want to edit the album.tpl you can even put the Callback and extra template stuff in a block which you can add to album pages from within your theme configuration.
Easy peasy.
You probably *don't* want to have a new GalleryItem as a derivative of a GalleryAlbumItem *unless* what you *really* have is some new kind of album with extra behaviours (methods) that you need to code for. Simply showing some extra info on an album page isn't really enough to merit that, I would say.
Which bit do you want help with?
Posts: 5
Well I'm basically using Gallery as a container for a reporting system I'm putting together. Some albums are reports which contain images. I can do this simply with a callback it seems. No need to go too far with this if it's not necessary. A callback will allow me to pull in the information I need, and then I can create custom views for each different type of report I want to run, no?
Posts: 4342
Hmmm. Gallery is designed bottom-up to be a gallery for photos, videos, pdfs, and other file-type items. The closer what you want to do is to that paradigm, the better it will work. I don't know the structure of one of your reports so it's hard to say how happy you're going to be.
For instance, now you're introducing the idea of "different type[s] of reports" which is clear to you in your head but not to me, so I think you need to provide more info.
What I suggested above is great if you want to display albums (or photos) with a few extra bits of info, a paragraph of text perhaps, some links, other fields that aren't catered for in any G2 module at present. It's (I'd guess) the way the exifdata module works. I can't advise how well it might work for your application as I don't know the ins-and-outs of what you're trying to do, which now sounds more complicated than at first.
Posts: 5
well this is basically a combination of gallery with a DB for the other aspect of the project. The reason I went this route instead of keeping them separate is because the reports are basically collections of images with some generic question and answer sets related to each user. The main report will pull in the question set and the images to display side-by-side. I need the hierarchical structure that Gallery provides for showing instances of this report where the data changes from time to time. Other views of the container user album will show statistics of the reports (albums) contained. Does that make a semblance of the sense it makes in my head?
-Alex
Posts: 4342
A semblance...
The question I'd consider next is what proportion of the "effort" (interpret that as you will) for each album/report is the collection of pictures, and what proportion the other stuff (q and a sets or whatnot.) If the non-picture stuff is significant, you might be better to use a CMS for that, keep the pictures in Gallery, and use Gallery embedded with the cms to display each album/report.
Gallery's got lots of tools for editing photos, but not a lot for editing and keeping the other content up to date, whereas something like Drupal, or Joomla or whatever will handle that side of thing more easily. A couple of text-boxes and one or two radio-buttons per album - that's easy enough to put into and take out of a single Gallery table. Personally I'm not sure how much further I'd want to go than that.
Posts: 5
Well actually, everything on Gallery will be purely display + comments/ratings of images. All actual data for the q&a is pushed from a .Net app I already made. For this approach to this, I think Gallery is great. Now I only need to figure out how to automate the creation of albums and users from my .Net app, joy
Posts: 4342
Ok cool. If you want specific technical info for how to do any of the stuff in G2, ask in this thread and I'll do my best to help.
Posts: 5
help please .....
I need to do a one-/two-time import of images and extra info from a previous database. Is there a way to access GalleryCoreApi and GalleryUtilities outside of a module? I'm wondering if there's a simple file or three i can include in a script and use the classes to properly build users and albums or if it's pretty well entangled to the point where it's prohibitive and the best way is in fact to mimic the migrate module (which is partially what I plan to do, just simplify it a bit inside of a script)
Thanks again for all the pointers, I'd still be lost utterly ....
-Alex
Posts: 4342
http://codex.gallery2.org/Gallery2:How_To_Write_Scripts