Documentation: Splitter

Installation:

Unzip the archive and copy the folder splitter into the /expressionengine/third_party/-directory inside your system-directory.

Tag:

{exp:splitter}{/exp:splitter} 

Parameters:

blocks="X" 

Mandatory. Sets the number of blocks you want.

class="X" 

Optional. Sets the CSS class name for the <div> surrounding a block of list items.

delimiter="X" 

Mandatory. This must be a unique string in your list that separates any two items.

Example 1

{exp:weblog:categories weblog="default" style="linear"}
 
<li><a href="{path=site/index}">{category_name}</a></li>
{/exp:weblog:categories} 

In this example the delimiter would be: </li>


Example 2-

{exp:weblog:entries weblog="default"}
 
<a href="{permalink=site/comments}">{title}</a><br />
{/exp:weblog:entries} 

In this example the delimiter would be: <br />

Example 3-

1<!-- //-->2<!-- //-->3<!-- //-->4<!-- //-->5<!-- //--> 

In this example the delimiter would be: <!—//—>

I hope you get the point wink

block_start="" 

Optional. You can specify some text that will be added at the beginning of each block, that is, after each opening <div>.

block_end="" 

Optional. You can specify some text that will be added at the end of each block, that is, before each opening </div>.

The above parameters can be used to create self-contained HTML-lists per block for example:

{exp:splitter blocks="2" delimiter="</li>" class="myclass" block_start="<ul>" block_end="</ul>"}
  {exp
:weblog:categories weblog="default_site" style="linear"}
  
<li>{category_name}</li>
  
{/exp:weblog:categories}
{
/exp:splitter} 

returns

<div class="myclass">
<
ul>
  <
li>One</li>
  <
li>Two</li>
  <
li>Three</li>
</
ul>
</
div>
<
div class="myclass">
<
ul>
  <
li>Four/li>
  <
li>Five</li>
  <
li>Six</li>
</
ul>
</
div

A note on pagination

If you use Splitter in combination with {exp:weblog:entries} or
{exp:comment:entries} and want to use pagination you have to place special markers
inside your {paginate}-tagpair to help Splitter identify the pagination
codeblock.

Just insert <!—pagination //—> after the opening and before the closing
{paginate}-tag. The markers will be completely removed before the page is
rendered.

Example 1:

{paginate}<!-- pagination //-->
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
<!-- 
pagination //-->{/paginate} 

Example 2:

{paginate}<!-- pagination //-->
{if previous_page}<a href="{auto_path}">Previous Page</a> &nbsp;{/if}
{if next_page}
<a href="{auto_path}">Next Page</a>{/if}
<!-- pagination //-->{/paginate} 

Changelog:

  • Version 2.0
    • Initial release for ExpressionEngine 2