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}

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 31 2025 04:16:45
Script start
Timing: Jan 31 2025 04:16:45
Module start 'layout'
Timing: Jan 31 2025 04:16:45
Module start 'content'
Timing: Jan 31 2025 04:16:45
Module end 'content'
Timing: Jan 31 2025 04:16:45
Script end

Main resources:

Total runtime0.0184 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.6563151.2109
Module start 'layout' 0.00540.0031 739.867237.1094
Module start 'content' 0.00850.0081 776.976698.4453
Module end 'content' 0.01660.0018 875.421937.9922
Script end 0.0184  913.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002714.7554140.0002
Check MTime0.00115.9757140.0001
Mysql Total
Database connection0.00073.685310.0007
Mysqli_queries0.002614.017930.0009
Looping result0.00000.108710.0000
Template Total0.00137.110.0013
Template load0.00105.340310.0010
Template processing0.00031.780510.0003
Override
Cache load0.00073.729310.0007
General
dbfile0.00094.940580.0001
String conversion0.00000.049240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs