ez.no / ezpublish / documentation / customization / tips & tricks / splitting an article over several pages
These documentation pages are no longer maintained. Please visit the new documentation site.
This can be accomplished using a custom Article Page class as a child of an Article class.
Creating the Article Page Class
First create your new Content class and name it Article Page.
Set the identifier to article_page
Add an Integer datatype and name it Page Number
Set the identifier page_num
Mark it required. I did not specify a min max or default.
Add an XML Text Field datatype and name it Body
Set the identifier to body
Set it as searchable
Set preferred number of rows to 20
Store the class.
Finally, make sure that the anonymous role has read access to the newly generated content class.
Modifying the Templates
Go to: /design/your_site_design/override/templates
Open article.tpl in a text editor:
Add the following lines where you want the pages listed:
{* Subpages *} {let page_list=fetch(content,list,hash(parent_node_id,$node.node_id, sort_by,array(array(name)), class_filter_type,include, class_filter_array,array('article','article_page')))} {section show=$page_list} <h2>Pages</h2> Page: <a href={$node.url_alias|ezurl}>1</a> | {section name=Page loop=$page_list} <a href={$Page:item.url_alias|ezurl}>{$Page:item.name|wash}</a> | {/section} {/section} {/let}
In the default article-view-template in the admin interface the new-menu is hidden. Make it show again by removing the comment code. It should look like this in /design/admin/override/templates/article.tpl:
<div class="buttonblock"> {switch match=$content_object.can_create} {case match=1} <input type="hidden" name="NodeID" value="{$node.node_id}" /> <select name="ClassID"> {section name=Classes loop=$content_object.can_create_class_list} <option value="{$:item.id}">{$:item.name|wash}</option> {/section} </select> <input class="button" type="submit" name="NewButton" value="{'Create here'|i18n('design/standard/node/view')}" /> {/case} {case match=0} {/case} {/switch} </div>
Create an Article
Start by creating a regular Article. Add an intro and some content. This will be your first page. Store your Article.
Adding a New Page
Click on the newly created Article. Use the new-menu you made visible to create an Article Page.
Now enter the number of this page. In this case 2.
(If you accidentally make two page 1s or two page 2s it will not break anything but your navigation will be pretty confusing. If anyone knows how to have a class autoincrement itself based on its sibling classes feel free to post the solution here)
Fill in the body of your second page and save your changes.
More pages can be added in the same manner.
Possible problems
If it is not working check to make sure you created your new pages in your original Article class. If you put them somewhere else they will not appear in the page listing.
Comments
Working in 3.5 or later- allowing a child of the article class
Mark Marsiglio
Saturday 03 December 2005 1:39:37 pm
Example no longer valid
James Ward
Thursday 10 June 2004 11:03:05 pm
Instead use this example:
http://www.ez.no/ez_publish/docum...stomization/custom_design/pagination
Wrong full_class_2.tpl in 3.1-1?
Kai Brandt
Sunday 13 July 2003 10:32:27 pm
<h1>{attribute_view_gui attribute=$node.object.data_map.title}</h1>
{attribute_view_gui attribute=$node.object.data_map.intro}
{attribute_view_gui attribute=$node.object.data_map.body}
So, where should I do the changes?