How can I show a custom field on an album

accleas

Joined: 2005-04-20
Posts: 25
Posted: Thu, 2005-08-25 18:28

I created a custom field named "category" for albums.
I inserted {$theme.item.category} into album.tpl but the "category " cannot display.

Could someone help me? Thanks in advance.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-08-25 20:58
 
accleas

Joined: 2005-04-20
Posts: 25
Posted: Sun, 2005-08-28 06:23

Thanks Shocksll :D

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Tue, 2005-08-30 16:25

I think I'm having a dumb moment.

I've added a custom field, called Price. This shows up in the list of photos in an album. However it doesn't show when I view a single photo. I've been banging my head on this for ages and am desperate for an answer. I've read the customisation guide, and I've read all about smarty. I'm still confused. I've turned on debug output and searched for "customfield" and "Price", but neither appear, and thats with

{g->callback type="customfield.LoadCustomFields" itemId=$theme.item.id}

placed in the template at the top. What am I missing?

Thanks for putting up with my stupiditiy :)

[EDIT] Forgot to mention that both of these fields appear in the debug output when I view them in album mode, it's just they don't in photo.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-08-30 16:44

Do you have it set as a Detail or Summary? The callback only returns fields that have the detail checkbox turned on. Also, is this a common Custom Field?

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Tue, 2005-08-30 16:52

It has both summary and detail boxes checked.

Common Custom Field? Not sure, I added the custom field module, then added it in there. How can I tell if its common?

Thanks for the lightning reply. :)

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Tue, 2005-08-30 16:56

Oh, I've just seen what you mean. There are 3 columns. It's in the Photo (Right hand) column. Is that where I went wrong?

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Tue, 2005-08-30 17:07

Guess not, because I added a Common field, and had only detail enabled, and it still didn't show. More confusion.

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Tue, 2005-08-30 17:11

Which bit of code in the template should be showing the custom fields?

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-08-30 18:53

In my custom theme I outputted the price custom field like this:

{if !empty($block.customfield.LoadCustomFields.fields.Price)}
  &amp;&amp;<b>Price: 
  {if is_numeric($block.customfield.LoadCustomFields.fields.Price)}${/if}
  {$block.customfield.LoadCustomFields.fields.Price}</b>
{/if}

In the photo.tpl, you may need to add showSummaries=true to the iteminfo block. So change

                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=true
                          showOwner=true
                          class="giInfo"}

to

                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=true
                          showOwner=true
                          showSummaries=true
                          class="giInfo"}

See if that does it.

 
A_Bloke

Joined: 2005-08-23
Posts: 13
Posted: Wed, 2005-08-31 00:42

None of those worked...however I found out what does, and it's simple, of course.

I went to the Admin section, and edited the theme, and added Custom Fields to the Photo.tpl list. Then it appeared, how silly of me. Much thanks for your help, it helped me understand what was going on a little more.

*Tips his hat in your direction*