Forums / Developer / Alpha pagination of objects

Alpha pagination of objects

Author Message

steve walker

Thursday 15 September 2005 8:16:10 am

Hi,

OK, here is the final code I have in the template to be used as a folder override for a contacts area:

{* Alpha Paginated Contact Folder - Full view *}
{set-block scope=root variable=cache_ttl}0{/set-block}
{let filter=first_set(ezhttp('filter',get),"all")}
{let ffilter=concat($filter,'*')}
 {switch match=$filter}
    {case match="all"}
 	  {set ffilter="*"}
    {/case}
    {case/}
    {/switch}
<div class="content-view-full">
    <div class="class-folder">

        <h1>{$node.object.data_map.name.content|wash()}</h1>

        
            <div class="attribute-short">
                {attribute_view_gui attribute=$node.object.data_map.short_description}
				<a href="?filter=a">A</a>&nbsp;|&nbsp;<a href="?filter=b">B</a>&nbsp;|&nbsp;<a href="?filter=c">C</a>&nbsp;|&nbsp;<a href="?filter=d">D</a>&nbsp;|&nbsp;<a href="?filter=e">E</a>&nbsp;|&nbsp;<a href="?filter=f">F</a>&nbsp;|&nbsp;<a href="?filter=g">G</a>&nbsp;|&nbsp;<a href="?filter=h">H</a>&nbsp;|&nbsp;<a href="?filter=i">I</a>&nbsp;|&nbsp;<a href="?filter=j">J</a>&nbsp;|&nbsp;<a href="?filter=k">K</a>&nbsp;|&nbsp;<a href="?filter=l">L</a>&nbsp;|&nbsp;<a href="?filter=m">M</a>&nbsp;|&nbsp;<a href="?filter=n">N</a>&nbsp;|&nbsp;<a href="?filter=o">O</a>&nbsp;|&nbsp;<a href="?filter=p">P</a>&nbsp;|&nbsp;<a href="?filter=q">Q</a>&nbsp;|&nbsp;<a href="?filter=r">R</a>&nbsp;|&nbsp;<a href="?filter=s">S</a>&nbsp;|&nbsp;<a href="?filter=t">T</a>&nbsp;|&nbsp;<a href="?filter=u">U</a>&nbsp;|&nbsp;<a href="?filter=v">V</a>&nbsp;|&nbsp;<a href="?filter=w">W</a>&nbsp;|&nbsp;<a href="?filter=x">X</a>&nbsp;|&nbsp;<a href="?filter=y">Y</a>&nbsp;|&nbsp;<a href="?filter=z">Z</a>&nbsp;|&nbsp;<a href="?filter=all">show all</a>
            </div>
       

        {section show=$node.object.data_map.description.content.is_empty|not}
            <div class="attribute-long">
                {attribute_view_gui attribute=$node.object.data_map.description}
            </div>
        {/section}
{*Shows all attributes of current node }

{let node=fetch(content, list, hash(limit, 6, parent_node_id, 2, depth, 3, sort_by,array(published,false()), class_filter_type, include, class_filter_array, array(article)) )}
{$node|attribute(show) *} 

{section show=or($node.node_id|eq(2)) }
 {include uri="design:content/advancedsearch.tpl"}
{/section}

        {section show=is_unset( $versionview_mode )}
        {section show=$node.object.data_map.show_children.content}
            {let page_limit=10
                 list_items=array()
                 list_count=0}

           
                 {set list_items=fetch_alias( children, hash(
        parent_node_id, $node.node_id,                                                  
        offset, $view_parameters.offset,
        attribute_filter, array(
            'and',
            array( 'person/last_name', 'like', $ffilter  )
            ),
        sort_by, $node.sort_array,
        limit, $page_limit
        )
    )}
															 
                {set list_count=fetch_alias( children_count, hash( parent_node_id, $node.node_id ) )}
            

            <div class="content-view-children">
                {section var=child loop=$list_items sequence=array(bglight,bgdark)}
                    {node_view_gui view=line content_node=$child}
                {/section}
            </div>
{*section show=or($node.object.section_id|eq(6), $node.object.section_id|eq(7)) }
 {include uri="design:content/advancedsearch.tpl"}
{/section*}

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

        {/section}
        {/section}

    </div>
</div>
{/let}
{/let}

I havent tested this extensively, but it seems to be working fine.

Once again, thanks for the help on this.

Regards, Steve.

http://www.oneworldmarket.co.uk

Douglas Hammond

Wednesday 01 March 2006 10:04:52 am

This works to sort any folder by the name of it's contents

<h1>{$node.name}</h1>
{let filter=first_set(ezhttp('filter',get),"all")}
{let ffilter=concat($filter,'*')}
{switch match=$filter}
	{case match="all"}
		{set ffilter="*"}
	{/case}
{/switch}
<a href="?filter=a">A</a>&nbsp;|&nbsp;<a href="?filter=b">B</a>&nbsp;|&nbsp;<a href="?filter=c">C</a>&nbsp;|&nbsp;<a href="?filter=d">D</a>&nbsp;|&nbsp;<a href="?filter=e">E</a>&nbsp;|&nbsp;<a href="?filter=f">F</a>&nbsp;|&nbsp;<a href="?filter=g">G</a>&nbsp;|&nbsp;<a href="?filter=h">H</a>&nbsp;|&nbsp;<a href="?filter=i">I</a>&nbsp;|&nbsp;<a href="?filter=j">J</a>&nbsp;|&nbsp;<a href="?filter=k">K</a>&nbsp;|&nbsp;<a href="?filter=l">L</a>&nbsp;|&nbsp;<a href="?filter=m">M</a>&nbsp;|&nbsp;<a href="?filter=n">N</a>&nbsp;|&nbsp;<a href="?filter=o">O</a>&nbsp;|&nbsp;<a href="?filter=p">P</a>&nbsp;|&nbsp;<a href="?filter=q">Q</a>&nbsp;|&nbsp;<a href="?filter=r">R</a>&nbsp;|&nbsp;<a href="?filter=s">S</a>&nbsp;|&nbsp;<a href="?filter=t">T</a>&nbsp;|&nbsp;<a href="?filter=u">U</a>&nbsp;|&nbsp;<a href="?filter=v">V</a>&nbsp;|&nbsp;<a href="?filter=w">W</a>&nbsp;|&nbsp;<a href="?filter=x">X</a>&nbsp;|&nbsp;<a href="?filter=y">Y</a>&nbsp;|&nbsp;<a href="?filter=z">Z</a>&nbsp;|&nbsp;<a href="?filter=all">show all</a><br /><br />

{let page_limit=20 
	children=fetch('content','list', hash(
								parent_node_id,$node.node_id,
								sort_by,$node.sort_array,
								limit,$page_limit,
								offset,$view_parameters.offset,
								attribute_filter, array('and', array( 'name', 'like', $ffilter ))
								))

    list_count=fetch('content','list_count',hash(
								parent_node_id,$node.node_id,
								attribute_filter, array('and', array( 'name', 'like', $ffilter ))
								))
}

{section name=Child loop=$children sequence=array(bglight,bgdark)}
	{node_view_gui view=line content_node=$Child:item}<br />
{/section}

{include name=navigator uri='design:navigator/google.tpl' page_uri=concat('/content/view','/full/',$node.node_id) 
item_count=$list_count view_parameters=$view_parameters item_limit=$page_limit} 

{/let}
{/let}

eZ debug

Timing: Jan 18 2025 18:21:41
Script start
Timing: Jan 18 2025 18:21:41
Module start 'content'
Timing: Jan 18 2025 18:21:42
Module end 'content'
Timing: Jan 18 2025 18:21:42
Script end

Main resources:

Total runtime1.1891 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.2344180.8359
Module start 'content' 0.00650.9546 769.0703509.6328
Module end 'content' 0.96110.2280 1,278.7031360.2578
Script end 1.1890  1,638.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3327210.0002
Check MTime0.00140.1186210.0001
Mysql Total
Database connection0.00060.047410.0006
Mysqli_queries1.120594.23091910.0059
Looping result0.00190.16281890.0000
Template Total1.165498.020.5827
Template load0.00230.194620.0012
Template processing1.163197.812220.5816
Template load and register function0.00020.019510.0002
states
state_id_array0.00070.059010.0007
state_identifier_array0.00080.065420.0004
Override
Cache load0.00190.1630120.0002
Sytem overhead
Fetch class attribute can translate value0.00140.121330.0005
Fetch class attribute name0.00050.046220.0003
XML
Image XML parsing0.00050.040930.0002
class_abstraction
Instantiating content class attribute0.00000.000320.0000
General
dbfile0.00510.4287210.0002
String conversion0.00000.000530.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/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: 9
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs