[Petal] Accessing a list of hashes

William McKee william@knowmad.com
Wed, 11 Sep 2002 13:34:02 -0400


Jean-Michel,

Is it possible to access an array of hashes in my templates using a syntax 
like the following:

$hash{'fields'} = [ {'name' => 'field1', 'value' => 'value1'},
				   {'name' => 'field2', 'value' => 'value2'},
				];

The in my template use:

<span petal:repeat="field fields">
<td petal:content="field/name"><b>field_name</b></td>
<td petal:content="field/value">field_value</td>
</span>

Right now I'm getting the following error message:
	Cannot find value for field/name: name cannot be retrieved

The docs do not seem to indicate whether this technique is valid or not.

Thanks,
William
-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com