Forums / Setup & design / Paging

Paging

Author Message

thomas BAILLEUL

Thursday 02 November 2006 6:03:57 am

Hi,

I have built a site with several folders, but I can display all of them in the same page, so there are 2 links added with 2 others pages.
But I want just show all folders in the same main page(homepage web site in fact), displaying it in differents columns, so I need to create a navigation.tpl like google.tpl or simple.tpl,
I am on it but as I'm not a geek so if anyone have had ever to do that I woud be grateful if you could share your work!

Nabil Alimi

Thursday 02 November 2006 9:58:03 am

Hi Thomas,

You are probably using fetch( content , list ) to display your folders.
http://ez.no/doc/ez_publish/technical_manual/3_7/reference/modules/content/fetch_functions/list

If that's the case, you need to deal with the <b>offset</b> parameter of this function and ezpublish view_parameters system http://ez.no/doc/ez_publish/technical_manual/3_8/templates/basic_template_tasks.

A quick example :

{def $my_folders=fetch( content , list , hash( parent_node_id , 2 , offset , $view_parameters.offset , limit , 5 ) )}

{* Here you display your content *}

{* The navigator *}
<a href={concat( $the_path_you_need , '/(offset)/' , 6 )|ezurl}>1</a>
<a href={concat( $the_path_you_need , '/(offset)/' , 11 )|ezurl}>2</a>

So when you'll click on "5", this will display 5 elements from the fifth.

Hope it helped.

PS : You don't need to be a geek in order to deal with EzPublish. :-)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

thomas BAILLEUL

Friday 03 November 2006 3:52:19 am

Hi Nabil,

Thanks for your help, it helps me
but you don't really get it , I mean I want displaying all my folders in the same page divided into 3 columns I don't link for an other page with the next folders
I try following this link : http://ez.no/community/articles/building_a_custom_template_for_a_news_portal/main_override_template
I use the code above :

<width="100%">
<tr>
<td>
<ul>
{def $my_folders=fetch( content , list , hash( parent_node_id , 2 , offset ,
$view_parameters.offset , limit , 30)) }
{foreach $my_folders as $key => $folder max 30 offset 5}
<li>
{node_view_gui =small content_node=$folder}
</li>
{delimiter}
{if eq($key|mod(2),0)}
{/delimiter}
{/foreach}
</ul></td><td><ul>
{/if}
{/delimiter}
</ul>
</td>
</tr>
</table>
but it doesn't work.
I would be grateful for help!

Claudia Kosny

Tuesday 07 November 2006 10:35:38 am

Hi Thomas

You have a couple of errors in your template code that should have given you some error messages in your debug output. Next time check there first or if you did, post the error messages as well.

Anyhow, the example code in the file you linked to is something like this:

   {* Show the next nine small news articles *}
   <table width="100%">
   <tr>
     <td>
     <ul>
   {foreach $articles_array as $key => $article max 9 offset 5}
       <li>
       {node_view_gui view=small content_node=$article}
       </li>
       {delimiter}
       {if eq($key|mod(3),0)}
       </ul></td><td><ul>
       {/if}
       {/delimiter}
   {/foreach}
     </ul>
     </td>
   </tr>
   </table>

You want to show all folders so you need to take out the max and the offset from the foreach. Then replace the article array with your folder array and you are done.

If you compare that to the code you posted you can see that the nesting of the tags is not correct in your code. Also there is a losing delimiter tag to much.

If you still have problem, post again. But then explain what exactly is not working, i.e. what is the output of your code vs what you want to achieve.

Greetings from Luxembourg

Claudia