views:

17

answers:

1

I'm working on a modification from a theme in the open source project "gallery2".

Here is the code that I am looking at:

For anyone familiar with it, its in the SearchShowAll.tpl file in the search module in the modules section of the download.

 <ul class="giInfo">
   {foreach from=$result.fields item=field }
              <li>
                <span class="ResultKey">{$field.key}:</span>
                <span class="ResultData">{$field.value|default:"&nbsp;"|markup}</span>
              </li>
   {/foreach}
 </ul>

It is a smarty foreach loop and it grabs this data
Title: BB 08 PR 6-340
Summary:
Keywords: A Hillbilly Cat; Gavin Jordan; Margo Hazell
Description:
Owner: Gallery Administrator

However, I just want it to get the Title: and display it, not any of the other stuff. I am unsure of what the array looks like and how to get a specific value from it in smarty format and also in the case of this gallery.

A: 

I used section tags to figure this out. I was referencing the array value wrong as well. Here is how I got it to work.

{section name=field loop=$result.fields max=1}
              <li>
                <span class="ResultData">{$result.fields[field].value|default:"&nbsp;"|markup}</span>
              </li>

{/section}
bob