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!

eZ debug

Timing: Jan 20 2025 14:22:37
Script start
Timing: Jan 20 2025 14:22:37
Module start 'content'
Timing: Jan 20 2025 14:22:38
Module end 'content'
Timing: Jan 20 2025 14:22:38
Script end

Main resources:

Total runtime0.9996 sec
Peak memory usage4,096.0000 KB
Database Queries211

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.8516180.8438
Module start 'content' 0.00650.8809 769.6953661.3906
Module end 'content' 0.88740.1121 1,431.0859341.0859
Script end 0.9995  1,772.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3647210.0002
Check MTime0.00130.1316210.0001
Mysql Total
Database connection0.00080.085010.0008
Mysqli_queries0.920892.11362110.0044
Looping result0.00160.15772090.0000
Template Total0.974597.520.4872
Template load0.00200.197120.0010
Template processing0.972597.289720.4862
Template load and register function0.00030.026210.0003
states
state_id_array0.00120.118910.0012
state_identifier_array0.00070.067720.0003
Override
Cache load0.00180.1777730.0000
Sytem overhead
Fetch class attribute can translate value0.00100.102240.0003
Fetch class attribute name0.00090.0870100.0001
XML
Image XML parsing0.00250.249240.0006
class_abstraction
Instantiating content class attribute0.00000.0013100.0000
General
dbfile0.00680.6805340.0002
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 54
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs