Share » Forums » Setup & design » Access selection datatype

Access selection datatype

Access selection datatype

Saturday 07 June 2008 7:06:58 am - 1 reply

Modified on Saturday 07 June 2008 7:21:10 am by Robert Malevic

Author Message

Maxime Thomas

Sunday 10 August 2008 10:49:57 pm

Hi,

I'm not sure to understand what you want to do. I give a try so :
You would like to have a FAQ content. For this FAQ you would like to have a category filter ?

If it's that, you can easily reach some information :
- in each content template, the $node value is provided. you can use the following code to show what is inside this variable :

{$node|attribute(show,1)}

- in the $node, you've got the data_map array which is an array of your attributes. You can access the category attribute like this :

{$node.data_map.category}

- on each attribute, you can use the content function to get back the value of the content. For the selection datatype, the content function returns an int of the selected category. The list of category are stocked in the content of the content class attribute.

- finally, if you want to display all the faq filtered by a category, in your template a code like this :

<form action="{$node.url_alias|ezurl('no')}" action="post">
<select name="category">
{foreach $options as $o}
<option value="{$o.value}">{$o.name|wash}</option>
{/foreach}
</select>
</form>

- and to find your selected category :

{def $selected_category=ezhttp('category', 'post')}
{$selected_category}

Hope it helps...

Max

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu