How do I paginate an article/xml block?

Author Message

Wei Dai

Friday 26 September 2008 2:57:29 am

How I paginate an xml block content if an article is too long?

I used google and simple navigators before, but I knew they are used for paginate a list of nodes use offset.

What if I want to paginate an article to several pages if it is too long? Is there a template operator for this, like the one Joomla provides?

Or I can configure the navigators to do this?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Richard Lundberg

Friday 26 September 2008 6:33:45 am

Use the article (Main Page) and article (sub page) classes. Place the sub pages under the main pages. This provides both an article menu and a "previous" "next" style navigators on each page.

www.peakm3.com

Sebastiaan van der Vliet

Friday 26 September 2008 6:44:13 am

Hi,

I tried getting this to work with a custom tag for the xml block. It might work, but you will need to test:

to content.ini.append.php, add the following lines:

[CustomTagSettings]
AvailableCustomTags[]=multipage
IsInline[multipage]=true

[multipage]
CustomAttributes[]=page

Create a template called 'multipage.tpl' in the folder: \design\[your_design_folder]\templates\content\datatype\view\ezxmltags\

Add the following code to the template 'multipage.tpl':

<!--page-->

Create a template called 'ezxmltext.tpl' in the folder: \design\[your_design_folder]\templates\content\datatype\view

Add the following code to the template 'ezxmltext.tpl':

{if $attribute.content.output.output_text|contains("<!--page-->")}
	{def $pages=$attribute.content.output.output_text|explode("<!--page-->")}
	
	{$pages[$DesignKeys:used.view_offset]}
	
	<hr>
	{def $object=fetch('content','object',hash('object_id',$attribute.contentobject_id))
	     $view_parameters=hash('offset',$DesignKeys:used.view_offset)}
	{include name=navigator
		uri='design:navigator/google.tpl'
		page_uri=$object.main_node.url_alias
		item_count=$pages|count
		view_parameters=$view_parameters
		item_limit=1}


{else}
	{$attribute.content.output.output_text}
{/if}

Finally, you would have to modify your existing article template so it displays (for example) only the body xml block, and no other attributes, when your offset is > 0.

How to use:
Go the the edit view for the page. Add a multipage custom tag wherever you want to start a new page.

Kind regards,
Sebastiaan

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

zurgutt -

Tuesday 30 September 2008 12:57:57 am

One not so obvious but possibly easiest way is to not use separate pages at all but have whole article on one page and to use javascript to show/hide parts of it to create pagination effect. It is also much faster for the user and i doubt extra 0.1 seconds of initial page load time will be problem.

Certified eZ developer looking for projects.
zurgutt at gg.ee

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

Main resources:

Total runtime0.7955 sec
Peak memory usage8,192.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.2500151.2266
Module start 'layout' 0.00580.0040 739.4766220.7188
Module start 'content' 0.00980.7847 960.19534,545.0938
Module end 'content' 0.79450.0009 5,505.289111.8281
Script end 0.7954  5,517.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4567160.0002
Check MTime0.00130.1641160.0001
Mysql Total
Database connection0.00090.110710.0009
Mysqli_queries0.692287.0128640.0108
Looping result0.00070.0835620.0000
Template Total0.747594.020.3738
Template load0.00190.243120.0010
Template processing0.745693.728720.3728
Template load and register function0.00140.174310.0014
states
state_id_array0.00110.136610.0011
state_identifier_array0.00060.080120.0003
Override
Cache load0.00160.2023300.0001
Sytem overhead
Fetch class attribute can translate value0.00200.248540.0005
Fetch class attribute name0.00220.272870.0003
XML
Image XML parsing0.00871.090140.0022
class_abstraction
Instantiating content class attribute0.00000.001970.0000
General
dbfile0.00790.9883300.0003
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs