Forums / Setup & design / How many post in each page?

How many post in each page?

Author Message

Federico Canuti

Monday 07 November 2005 9:27:15 am

First of all, last time I didn't thank Lukasz Serwatka, so I do it now, your help has been precious.

Now I'm (still) working on a forum template and I want to give the registered users the possibility to decide how many threads or post per page they can see.
I've placed an integer attribut in the user class, now I can recall this value and put it in the correct template?
I believe the concerning code is:
{let page_limit=20
reply_limit=cond( $view_parameters.offset|gt( 0 ), 20,
19 )
I'v made some experiments writing numbers inside the template, now I have to take the correct value from my attribute?
How can I do it?

Łukasz Serwatka

Monday 07 November 2005 11:05:11 am

Hi Federico,

I'm glad that I could help you ;)

I your case you can use "User preferences", similar to admin interface, where you can set 10|25|50 objects per page. More about user preferences you can read here
http://ez.no/products/ez_publish_cms/documentation/incoming/user_preferences

Look also on template in admin interface e.g design/admin/templates/children.tpl You will find there example with ezpreference()

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Federico Canuti

Tuesday 08 November 2005 2:43:00 am

edit: I'll work on it, I'm trying to make it working for each integer (1-100)

Federico Canuti

Tuesday 08 November 2005 7:24:30 am

It looks like I've understood how it works but.. it doesn't work! I mean the links appear correctly and the system remember my selection but it doesn't change the visualization, even using the default template (and not mine) nothing happens.

Łukasz Serwatka

Tuesday 08 November 2005 7:46:08 am

Value from ezpreference will have to pass to fetch function as limit per page and to google navigator.

Something like

{let item_type=ezpreference( 'page_limit' )
     number_of_items=min( $item_type, 3)|choose( 10, 10, 25, 50 )
     list_count=fetch('content','list_count', hash( 'parent_node_id', $node.node_id ) )
     node_list=fetch( content, list, hash( parent_node_id, $node.node_id, limit, $number_of_items, offset, $view_parameters.offset ) )}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Federico Canuti

Tuesday 08 November 2005 8:51:25 am

Ops, now it doesn't work at all, Previously I was using this let section:

{let item_type=ezpreference( 'admin_list_limit' )
     number_of_items=min( $item_type, 5)|choose( 20, 1, 10, 20, 50, 100 )
     children_count=$node.children_count
     children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                          sort_by, $node.sort_array,
                                          limit, $number_of_items,
                                          offset, $view_parameters.offset ) ) }

none of the two works correctly for me but the one you posted not even affected the "case" setting.

Łukasz Serwatka

Tuesday 08 November 2005 9:18:02 am

Display your children with {section} or {foreach}, depends which version of eZ publish do you use.

{section loop=$children var=child}
    {node_view_gui view=line content_node=$child}
{/section}

and include google navigator

{include name=navigator
         uri='design:navigator/google.tpl'
         page_uri=$node.url_alias
         item_count=$children_count
         view_parameters=$view_parameters
         item_limit=$number_of_items}

Enable DebugOutput and you will see all errors if exists.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Federico Canuti

Wednesday 09 November 2005 3:30:28 am

Sorry but it doesn't work for me, probably because I solved the situation from a different point of view or because I understand only a litte of eZ so far.
I worked on the default template (3.6.0) modifying it to my needs so i got the elements visualized by

          {section var=reply loop=$reply_list sequence=array( bgdark, bglight )}
               {let owner=$reply.object.owner owner_map=$owner.data_map}
                      <h4>{$owner.name|wash}</h4>
                       {$reply.object.data_map.message.content|simpletags|wordtoimage|autolink}
</let>
</section>

This is not all the code (obvious), in my navigator the last line is "item_limit=$page_limit}".
I don't know what is the problem but do there is a solution from my point of view?
I mean like I said before I can change the page_limit in the beginning of the template to match my needs, so if I can recall the right value from an attribute and use it here I believe I can solve the situation.

eZ debug

Timing: Jan 21 2025 21:07:20
Script start
Timing: Jan 21 2025 21:07:20
Module start 'content'
Timing: Jan 21 2025 21:07:21
Module end 'content'
Timing: Jan 21 2025 21:07:22
Script end

Main resources:

Total runtime1.5578 sec
Peak memory usage4,096.0000 KB
Database Queries209

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 587.7109180.8359
Module start 'content' 0.00821.4024 768.5469630.7969
Module end 'content' 1.41050.1472 1,399.3438341.0625
Script end 1.5577  1,740.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.2928210.0002
Check MTime0.00190.1203210.0001
Mysql Total
Database connection0.00120.078710.0012
Mysqli_queries1.449393.03442090.0069
Looping result0.00260.16522070.0000
Template Total1.524097.820.7620
Template load0.00220.139720.0011
Template processing1.521897.687120.7609
Template load and register function0.00030.019310.0003
states
state_id_array0.00100.061110.0010
state_identifier_array0.00090.057620.0004
Override
Cache load0.00180.1182460.0000
Sytem overhead
Fetch class attribute can translate value0.00170.106430.0006
Fetch class attribute name0.00120.076990.0001
XML
Image XML parsing0.00090.059830.0003
class_abstraction
Instantiating content class attribute0.00000.0019110.0000
General
dbfile0.00970.6222290.0003
String conversion0.00000.000430.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
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 36
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs