direct access to long comment of media-library

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
mad-manne
Regular
Posts: 42
Joined: Wed Jan 23, 2008 4:56 pm
Location: Marl, Germany
Contact:

direct access to long comment of media-library

Post by mad-manne »

Hi everyone,
I am modifying my templates\default\admin\media_showitem.tpl in order to fit my needs, but I'm sort of stuck trying to catch just one media-property(the long comment field) I'd like to see instead of cycling through all of the media-properties as it is done by default:

Code: Select all

{foreach from=$media.file.base_property key="prop_fieldname" item="prop_content"}
I have tried things like:
  • {$media.file.long_comment}
  • {$media.file.base_property.long_comment}
  • {$media.file.base_property.comment_long}
, but to no avail so far :?

I also did some search but apparently i tried the wrong search-terms ...

Does anyone know an answer ?

Cheers,
Manfred.
Try not. Do or do not. There is no try. (YODA)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Okay, as I understand it, the $media.file.base_property has a bunch of prop_fieldname groups attached to it. Each prop_fieldname group contains a label, a val, a type, and a title. The label is a language-specific string for the title; the val is the content; the type is whether it's a string, number, or whatnot.

Confused yet? Here's what it comes down to: you'll need to loop through all the prop_fieldname groups and find the one with the title 'comment2'. Right now (if I'm reading your request and the code correctly), we loop through the groups and print all of them, as long as they have a value. You want only the comment2. So change:

Code: Select all

                {foreach from=$media.file.base_property key="prop_fieldname" item="prop_content"}
                {if $prop_content.val}
                    <dt>{$prop_content.label}</dt>
                    <dd>{$prop_content.val|@escape}</dd>
                {/if}
                {/foreach}
 
to this:

Code: Select all

                {foreach from=$media.file.base_property key="prop_fieldname" item="prop_content"}
                {if $prop_content.title == 'comment2'}
                    <dt>{$prop_content.label}</dt>
                    <dd>{$prop_content.val|@escape}</dd>
                {/if}
                {/foreach}
 
Judebert
---
Website | Wishlist | PayPal
mad-manne
Regular
Posts: 42
Joined: Wed Jan 23, 2008 4:56 pm
Location: Marl, Germany
Contact:

Post by mad-manne »

judebert wrote:Here's what it comes down to: you'll need to loop through all the prop_fieldname groups and find the one with the title 'comment2'.
I already "feared", that this was going to be the solution :roll:

Actually I had to look for COMMENT2, so that's how it looks like now:

Code: Select all

{if $prop_content.title == 'COMMENT2'}
    {$prop_content.val|@escape}
{/if}
Thanks for your help,
Manfred.
Try not. Do or do not. There is no try. (YODA)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Congratulations; I'm glad that's sorted out.
Judebert
---
Website | Wishlist | PayPal
Post Reply