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!

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

eZ debug

Timing: Jan 19 2025 00:59:48
Script start
Timing: Jan 19 2025 00:59:48
Module start 'layout'
Timing: Jan 19 2025 00:59:48
Module start 'content'
Timing: Jan 19 2025 00:59:48
Module end 'content'
Timing: Jan 19 2025 00:59:48
Script end

Main resources:

Total runtime0.8040 sec
Peak memory usage4,096.0000 KB
Database Queries74

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.0547152.6094
Module start 'layout' 0.00580.0028 741.664139.4141
Module start 'content' 0.00860.7940 781.0781660.3281
Module end 'content' 0.80260.0014 1,441.406320.1875
Script end 0.8040  1,461.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3992160.0002
Check MTime0.00130.1637160.0001
Mysql Total
Database connection0.00090.109410.0009
Mysqli_queries0.731991.0289740.0099
Looping result0.00070.0840720.0000
Template Total0.772496.120.3862
Template load0.00180.229820.0009
Template processing0.770595.832320.3853
Template load and register function0.00020.023610.0002
states
state_id_array0.00100.122910.0010
state_identifier_array0.00110.141420.0006
Override
Cache load0.00170.2117730.0000
Sytem overhead
Fetch class attribute can translate value0.00100.125130.0003
Fetch class attribute name0.00120.1542100.0001
XML
Image XML parsing0.00120.150130.0004
class_abstraction
Instantiating content class attribute0.00000.0020100.0000
General
dbfile0.00180.2224230.0001
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
21content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 54
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs