[SOLVED] hash/array manipulation

Author Message

Nicolas OTTAVI

Thursday 22 September 2005 9:04:18 am

Hi,

I want to retrieve the value of MetaDataArray[keywords] and I can't find how !

This is what I did, but this doesn't seem to work:

{def $tab=ezini('SiteSettings','MetaDataArray')}
{$tab.keywords}
{/def}

Your help is welcomed,

K.

Kristof Coomans

Thursday 22 September 2005 11:35:15 pm

What do you get with:

{$tab|attribute(show)}

?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Nicolas OTTAVI

Friday 23 September 2005 1:50:42 am

No that's not the good solution as it returns all the attribute of an array and other details like attribute name and type.

Thanks for your help,
K.

Frederik Holljen

Friday 23 September 2005 2:12:36 am

Kristof wants to know what output you get when you run

{$tab|attribute(show)}

That way it is possible to determine what the correct call would be to get MetaDataArray[keywords] directly.

Nicolas OTTAVI

Friday 23 September 2005 3:11:26 am

Ok, sorry, made a long time I did not use my English :)

So with the following code

{let $meta_data=ezini( 'SiteSettings','MetaDataArray' ) }
 {$meta_data|attribute(show)}		
{/let}

I get the following result

Attribute / type / Value
author string 'author'
copyright string 'gpl
description string 'Ez Publish cms'
keywords string 'cms, publish, ez Publish, ezpublish'

Then I did :

{$meta_data.keywords}

And it works now ... I might have done something wrong ...

Thanks for your help

Kristof Coomans

Friday 23 September 2005 6:14:57 am

I suddenly see what you did wrong: you must not close the </i>def</i> function with <b>{/def}</b>.

To destroy the variable you've created, you can use <i>undef</i> (see http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_functions/variables/undef).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.