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}