Question about an array in gallery2
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开发者_如何学JAVA 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:" "|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 AdministratorHowever, 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.
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:" "|markup}</span>
</li>
{/section}
精彩评论