Documentation > CMS Template API Library > Util > Paginate(Asset,String)
Paginate
For use with WYSIWYG fields only. Separates the field on page breaks, and returns a portion of the field based on the current page number (context.PageNumber). This may only be used in an output template. NOTE: Page numbers are added to filenames and URLs BEFORE any filename or url templates are run. If those templates overwrite the publish path or publish URL, then the template should add the page number using the context.PageNumber property.
public CrownPeak.CMSAPI.PaginateFieldResult Paginate(Asset,String)
Parameters
Name | Description | Type |
---|---|---|
paginateThis | The asset containing the WYSIWYG field. | CrownPeak.CMSAPI.Asset |
fieldName | Name of the WYSIWYG field. | System.String |
Code Example
C#
PaginateFieldResult result = Util.Paginate(asset, "Name"); // Print links to other pages foreach (PageLink link in result.PaginatedLinks) { if (link.IsCurrent()) { Out.WriteLine("{0}|", link.PageNumber); } else { Out.WriteLine("<a href=\"{0}\">{1}</a>|", link, link.PageNumber); } }