Custom Fields Output
ricardo m
Joined: 2007-01-27
Posts: 2 |
Posted: Sat, 2007-01-27 14:50 |
Hi there. http://codex.gallery2.org/index.php/Gallery2:How_to_display_custom_fields_next_to_thumbnail and pasted this code next to my thumbnails in album.tpl. I'm using Siriux template. {* Use the customfield.LoadCustomFields callback to get an array of fields *} Can anyoine help me? Thanks --- |
|
Posts: 27300
try
I guess the empty check is wrong
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team || G2 Theme Contest!
Posts: 24
Dave,
Using the forum guidance, I have been able to cancel out the existing Owner and Date on photo.tpl (due to their limitations) and I have successfully added Custom Fields Owner and Date. However, this information shows up under the photo Comments and is not readily apparent to the viewer.
Is there coding that I can add to photo.tpl so that these custom fields (without the title Custom Fields) shows up under the description (where the Date and Owner fields were originally located)? I would appreciate your help.
Dave Freeman
Posts: 27300
I think I understand your question....
Edit album, theme tab, 'Blocks to show on photo pages' reorder the custome filed block to be above the comment block.
@removing the title of the module edit:
/modules/customfield/templates/blocks/CustomFields.tpl
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team || G2 Theme Contest!
Posts: 24
Dave -
Thanks for the timely reply. Your guidance allowed me to get rid of the title "Custom Fields" and move my custom fields (Date and Owner) above any "Recent Comments" that might be on the photo page. However, rather than residing underneath the photo, I would like to position these custom fields to the right of the photo underneath any description text that might be there. This will make these custom fields more obvious to the viewer.
I assume this means some recoding of one of the files - possibly the photo.tpl file. I have reviewed the forum questions on Custom Fields and most responses relating to repositioning the fields on the photo page aren't sufficiently precise for me to understand what needs to be done. That's the guidance I need. What file needs changing and what coding in that file needs changing? Again, I really appreciate your helping this newbie.
Dave Freeman
Posts: 24
Problem Solved!! I didn't research the theme page enough to recognize there were two sections that controlled where custom fields are added to the photo page. Sorry for exercizing the troops.
Dave Freeman
Posts: 27300
glad you got it sorted.
_____________________________________________
Blog & G2 || floridave - Gallery Team || G2 Theme Contest!
Posts: 18
Umm, I would really love to know how to move the custom fields to the right of the photo. Any help on this is greatly appreciated. Here's my site currently.
http://www.gerrysfineirishart.com/gallery2/v/noelshaw/afternoon_chat.jpg.html
Posts: 18
Please help, I am using the Matrix theme.
Posts: 27300
Edit photo.tpl.
You will have to ad a table or a <div> around the image. Add some text to see where things show up. Once you get that far you can add the custom field.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Okay, so I am running Gallery 2 and am using a modified version of the Ebony template.
What I need to be able to do is display the "Custom Field" under each of the photo thumbnails on the album page. I have tried pasting your example code in various pages on the "album.tpl" file with no luck. The closest I got was pasting it into the template specific "modules/core/templates/blocks/local/iteminfo.tpl". Adding it into that file actually placed the item-specific Custom Field code under each of the items, but it didn't strip out the link code that I have in each of them (which works fine in the photo view). I would think displaying this in the Album view would be no problem considering I got it to display in the photo view with the build-in functionality of Gallery2 without modifying code.
Any suggestions would be appreciated, and let me know if you need more info.
Posts: 27300
I don't have the ebony theme but in matrix I add:
under
and it works for me.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Thanks for getting back to me. I tried adding that to the album.tpl file in the place you indicated and nothing happened. Is it possible that the theme is ignoring this file or do different templates reference things differently? You'd think that it would be a universal application across the board. Any other suggestions?
Posts: 27300
Clear cache?
FAQ: How can I clear cached data?
Do you have any data added to the custom fields?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Just tried clearing the template cache and still no go. I do have data in the custom fields, as they display fine in the photo view. Anything else?
Kyle
Posts: 27300
URL?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
http://fuseboxgraphics.com/gallery/main.php?g2_itemId=61
The "websites" section is the only album I want to use the custom fields for, to display the URL to each live site below each thumbnail, instead of having to go into each item to get to it.
Posts: 27300
Add some text to the same location, does it show up?
change to the matrix theme and change the album.tpl, does it work?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Alright, I changed templates and I am seeing an error where I added the code/test text - both with the same results. This is the error:
[Translation error: Array ( [one] => (%d item total) [many] => (%d items total) [count] => [arg1] => ) ]
I left the Matrix theme applied if it helps. I appreciate all your help.
Posts: 27300
Add some text without the code first. Does that work?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Added the text with no extra code and still nothing even after emptying the cache again.
Posts: 13
Hold on a sec....I updated the file from the old template...
Posts: 13
Okay, so I actually added the code to the Matrix themed album.tpl and that added the custom info to the album page, but it is not turning the code into links like on the individual photo pages. Is there a way to modify the code to have it convert it?
Posts: 27300
So you got it working on the album page?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Yes, I got it working in the matrix template, but not the ebony template that I use. There is also the matter of the link code not hyperlinking within the album view (which if I can't get to work properly, then showing the custom field on the album page is useless for my purposes). Any ideas?
Posts: 27300
Sorry I don't know much about the ebony theme. You will have to study the theme, perhaps the author of the theme will see this thread and help you out.
I don't understand. But if is specific the ebony theme, I suspect I will not be able to help much.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 13
Eureka, I've figured it out! This other board topic walked me through what else needed to be added to the code mentioned above to make it parse the hyperlinks properly: http://gallery.menalto.com/node/51080
For my uses with the Ebony theme, I had to add the code to the following: "modules/core/templates/blocks/local/iteminfo.tpl"
The modified code that I had to use is: (I stripped out the list item code, which I didn't need)
{g->callback type="customfield.LoadCustomFields" itemId=$child.id}
{foreach from=$block.customfield.LoadCustomFields.fields|markup item=customField}
{$customField}
{/foreach}
The BBcode that I was already using for my links in the Custom Fields now displays correctly in both the photo view (as it had before) AND on the album view. It is all thanks to the simple change of adding "|markup". I hope this helps other people as much as it did for me.