Forums / Developer / How use class option ?

How use class option ?

Author Message

anne martinet

Monday 19 May 2008 4:22:22 am

I'm sorry! But I don't know, how take the choice of user in the class option.
For exemple, if the user can choose to view (in his page) 3, 5 or 10 answer to a question.

I override /node/view/full.tpl : full_folder_film.tpl
I write :

{attribute_view_gui attribute=$node.object.data_map.option}

In option I define 3 options (3, 5, 10).
When I wrote :

<br/>VALEUR : {$node.object.data_map.option.content.option_list[0].id}
<br/>VALEUR : {$node.object.data_map.option.content.option_list[1].id}
<br/>VALEUR : {$node.object.data_map.option.content.option_list[2].id}

The 3 id are visible.

But I don't find how take current value choose by user.....If he wants 3 items, 5 or 10.....

Thanks

Felix Laate

Tuesday 20 May 2008 1:02:31 am

Hi Anne,

you could use $view_parameters:

Number of options:
<a href="_my_url_/(number_options)/3">3</a>
<a href="_my_url_/(number_options)/5">5</a>
<a href="_my_url_/(number_options)/10">10</a>

{if is_set ( $view_parameters.number_options  ) }
{for 0 to $view_parameters.number_options as $counter}
<br/>VALEUR : {$node.object.data_map.option.content.option_list[$counter].id}
{/for}
{else}
... whatever your default should be ...
{/if}

Hope this helps :-)

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

anne martinet

Tuesday 20 May 2008 5:55:52 am

Yes, you help me a lot!

But I don't understand!
When I write :


....
{let <b>nb_par_page</b>=0}
<a href="(nb)/3">3</a>.....
<a href="(nb)/5">5</a>.....
<a href="(nb)/10">10</a>

{if is_set($view_parameters.nb) }
{set <b>nb_par_page</b>=$view_parameters.nb}
{/if}

...
{let <b>page_limit=$nb_par_page</b>
children=fetch('content','list',hash('parent_node_id',$node.node_id,'sort_by',$orderByDate,<b>'limit',$page_limit</b>,'offset',$view_parameters.offset))

....


This comportement it's strange. It work good one time on 10.
The path change , for exemple:
http://192.168.1.113/ezpublish/index.php/ezwebin_site/Espace-Actualite/<b>Cinema/Sorties</b>/(nb)/5 it's the good
http://192.168.1.113/ezpublish/index.php/ezwebin_site/Espace-Actualite/<b>Cinema</b>/(nb)/5 it's the bad

????

anne martinet

Wednesday 21 May 2008 12:00:41 am

I find a solution:

I write :

<a href="http://192.168.1.113/ezpublish/index.php/ezwebin_site/Espace-Actualite/Cinema/Sorties/(nb)/3">3</a>

I give the path (in full), but I wrote in a template. So I want var to give me the full path of the node....
But I don't find this var....
It doesn't exist??

thanks

André R.

Wednesday 21 May 2008 12:45:13 am

<a href={concat( $node.url_alias, '/(nb)/', $nb_number )|ezurl()}>text</a>

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

anne martinet

Wednesday 21 May 2008 1:13:44 am

Thanks a lot :)

I find this variables, but I don't find how use it....
thanks again

anne martinet

Wednesday 21 May 2008 6:34:10 am

I succed to create a list of links. This list allow to user to choose the number of items per page.
As this:

...
<div class="List">
{let nb_par_page=2}
<a href={concat($node.url_alias,'/(nb)/3')|ezurl()}>3</a>.....
<a href={concat($node.url_alias,'/(nb)/5')|ezurl()}>5</a>.....
<a href={concat($node.url_alias,'/(nb)/10')|ezurl()}>10</a>

{if is_set($view_parameters.nb) }
{set nb_par_page=$view_parameters.nb} 
{/if}
</div>
...
        {let page_limit=$nb_par_page
                     children=fetch('content','list',hash('parent_node_id',$node.node_id,'limit',$page_limit)) 
...

Now, I want do the same thing, with the object option.
I create a class Folder_film with attribute option (it's an option). And "Sorties" is an instance of this class (Folder_film).
In this instance I define three options (3, 5, and 10).
I display this attribute in my templates full_folder_film :

<div class="Option">
{attribute_view_gui attribute=$node.data_map.option}
</div>

But I don't find (forum, documentation) how uses this attribute as my list ....

Thanks

anne martinet

Thursday 22 May 2008 1:04:59 am

I try to create my option, like that :

<div class="element">
  <label>{'Mon label'|i18n( 'design/ezwebin/override/templates/full_folder_film' )}</label>
  <select name="NbPage">
    <option value="3" {if eq($nb_page,3)}selected="selected"{/if}>{3|i18n( 'design/ezwebin/override/templates/full_folder_film')}</option>
    <option value="4" {if eq($nb_page,4)}selected="selected"{/if}>{4|i18n( 'design/ezwebin/override/templates/full_folder_film')}</option>
    <option value="5" {if eq($nb_page,5)}selected="selected"{/if}>{5|i18n( 'design/ezwebin/override/templates/full_folder_film')}</option>
    <option value="10" {if eq($nb_page,10)}selected="selected"{/if}>{10|i18n( 'design/ezwebin/override/templates/full_folder_film')}</option>
  </select>

</div>

<div class="buttonblock">
  <input class="button" type="submit" name="Valider"  value="{'Valider'|i18n( 'design/ezwebin/override/templates/full_folder_film')}" />
</div>

....
{*$nb_page is my page_limit*}

But my page doesn't change (I have always all of my items)

Please!