Hello!
I did search, but to no avail...
For G2.0, I'd like to have the same Custom Field show up in the Common, Album, and Photo Fields.
I.e. I only have to fill out the Common Field 'Coral Name' once and it shows up on both the album and the photo pages.
Is this possible?
Thanks!
Gallery version (not just "2"): 2.0
G1 installs x 9
G2 installs x 3
Posts: 32509
you set field values per item. item = either albums or dataitems (photo, movie, ...).
so a custom field value is a per item attribute.
if you edit an album and assign a value to a custom field, it's an attribute of this album item.
you can edit the photo.tpl to also show the custom field values of the parent album. is that what you want?
Posts: 96
ya, that'd work great! :D
i see this bit of code in photo.tpl and album.tpl
any hints on what that $block.1's valid values are? ;)
i can print out block.0, but block.1 appears to be another array.
thx!!
9 x G1
3 x G2
Posts: 32509
the only related docs we have right now:
http://codex.gallery2.org/index.php/Gallery2:Tpl_Reference#Blocks
maybe i could answer a more specific question...
Posts: 96
heya!
thx for the link!
my more specific question would be: would you happen to know what the $block.1 value is for:
i'm hoping to do something like this in local/photo.tpl (as per your suggestion - if i interpreted it correctly, ha!):
{* photo custom fields *} {foreach from=$theme.params.photoBlocks item=block} {g->block type=$block.0 params=$block.1} {/foreach} {* album custom fields *} {foreach from=$theme.params.photoBlocks item=block} {g->block type=$block.0 params="**value of $block.1 when called from album.tpl**"} {/foreach}
thx! :D
9 x G1
3 x G2
Posts: 32509
well, each block accepts some parameters. these parameters are different for each block.
see the template reference link from before for some examples.
Posts: 96
ok, so i see the help you referenced on the link above reguarding blocks:
and when viewing a photo, in photo.tpl, i can call the photo's custom fields:
but how can i pass the album's info to the block call from within the photo template?
i can do this and it 'works' for the photo:
but i'm not so sure it's 'working' so much as just going back to the default...
man, it seems like it would be easy, but i'm totally lost here.
i've been trying things like:
but just cannot find the answer!
any other clues?
9 x G1
3 x G2
Posts: 32509
see modules/customfield/Callbacks.inc
there you see what params are expected.
also see modules/customfield/templates/blocks/CustomFields.tpl
there you see the call for callbacks
{g->callback type="customfield.LoadCustomFields" itemId=$item.id|default:$theme.item.id}
the same pattern for all blocks.
- 'type' is always required.
- all additional parameters that you provide are automatically available in modules/moduleName/templates/blocks/blockName.tpl
- in blockName.tpl, most blocks call modules/moduleName/Callbacks.inc which gets its params from the g->callback call and not from your g->block call.
if you think the docs on codex need some clarification etc., i'd appreciate if you could update them.
thanks!