Hi,
I'm a bit new to gallery, but once I saw gallery2 I knew it was what i needed. However, I'm come across a snafo. I love being able to add custom fields to pictures/albums - but I need to be able to control them. When they are displayed and how they are displayed. How do I access the various custom fields within the templates? I used the smarty debug console to get a listing of the available tags as was suggested in the documentation, but I can't seem to understand it. There is $theme.params.albumBlocks.customfield and $theme.params.photoBlocks.customfield but there is nothing there. I have also seen $theme.children.itemSummaries.customfield - which is where I see my custom fields, but all the fields seem to be in this one line. How can I get access to each individual custom field?
Great work and thanks in advance for the help
Posts: 8601
custom field site admin (or edit album / custom fields) lets you decide which custom fields are displayed as summary info and which in the custom fields block. do you need some additional control?
Posts: 20
Yes, I do. I'd like to access each field seperately, mainly for layout and formatting. But i think i might also like to do some processing based on the field, like grouping by a category or something like that. For example, having category name at the top of a page, with its description at the bottom. Also, i think it would be useful to be able to include html in the decription field.
Posts: 352
Check out this thread.
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=32713
and this one
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=34993
Posts: 20
I have read those threads already, and tried going through them again. I just need more information. I put in the g->callback, but I can't seem to get {$theme.item.id} to work. For example, one field is location, so I have tried varations of {$theme.item.location} but to no avail. Also, this might be a smarty issue, but how do you call a field that has spaces in it? I tried playing with some of the code fragments in one of the posts, and got small progress and its very messy - but I can't figure out how to use that to call a field with spaces in it. For example I have a field called "Project Name" and one called "Types of Work Done" - i know i could probably shorten them to "ProjectName" or "TypesOfWorkDone" inside G2, but then the display of that field would look bad for users. Any help?
Posts: 20
I forgot to add that i have also tried the debug option turned on, and there doesn't seem to be any additional info added to it by including the g->callback. I do see a reference to customfields.Customfields in the popup, but nothing about whether there are any fields within that. The popup shows those arrays being 0 (for both album and photo)
Posts: 352
you access the customfield like this:
Personally I don't know how to access fields with spaces in them in smarty, in a php block you can do it like this
Also, make sure you are calling these after you call the
Posts: 352
another example of something you can do to fix the space problem
This means that you will now have two variables
and
That you can use in the smarty. There's probably a better way but I don't know it.