utilitees

- Addons for ExpressionEngine 1.6.x

Splitter Documentation

Download Download

Installation:

Unzip the archive and copy the file pi.splitter.php into the plugins-directory inside your Expression Engine system-directory.

Back to top

Tag:

{exp:splitter}{/exp:splitter} 

Back to top

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
Back to top

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} 
Back to top

Questions / bug reports

For general comments, brickbats & bouquets please use the form over here.
Name:

Email:

URL:


Remember my personal information
Notify me of follow-up comments?


Page 1 of 2 pages  1 2 >

User Talk

Oliver:
2009-11-09 21:02

Well, I could, sure.

If you look at the last usage example, would it perhaps be feasible for you to create separate lists using block_start and block_end?



spacewalk:
2009-11-09 15:40

Splitter is great and works well. Thank you.

However, I typically use DOCTYPE XHTML 1.0 Strict. Splitter causes many validation errors because it is not valid to insert divs inside uls.

Could you offer users a pref whereby they could insert spans instead?



smartpill:
2009-10-16 06:19

Nevermind. I was thinking this worked completely differently. It all makes sense and works fine. Sometimes I need to step away from the Mac for a bit.



smartpill:
2009-10-16 01:56

Hi Oliver, I’m using 1.2.1 and I can’t get it to split. I have 3 test entries and set the blocks to 2, but it’s only making 1. here’s my code:

{exp:splitter blocks="3"  delimiter="<br />"  class="half" }
{exp
:weblog:entries weblog="{embed:my_weblog}" category="1" sort="asc" orderby="date" disable="category_fields|member_data|trackbacks"  
status="not closed|Pending" limit="8"}
<span>{title}</span>{summary}{body}{/exp:weblog:entries}{/exp:splitter} 

I was also wondering why there needs to be a delimiter. Since I would generally either wrap something like a list with a tag pair, I don’t see why a single tag is mandatory.

I do have this working on another site running 1.6.7, so maybe there’s a conflict with another add-on or possibly with EE 1.6.8 Build: 20091002?



Oliver:
2009-08-25 20:53

It’s right here: http://expressionengine.com/docs/modules/weblog/parameters.html#par_limit

Glad you got it solved.



Mark:
2009-08-25 20:51

Oliver ... that fixed it. I was looking all over for info the ‘limit=’ parameter but did not find it ... I just guessed I should try adding it and it appears to have solved my problem.  Thanks!



Oliver:
2009-08-25 20:43

Is that splitter related? What are you splitting? The output of an exp:weblog:entries-tag?

If you don’t specify a limit=”” parameter in that it will default to 100. Could that be the issue at hand?



Mark:
2009-08-25 19:02

Oliver ... great plug-in!  Having one issue that I can’t seem to resolve ... once the entries in a column hit 50, it won’t display any more entries. So, if there’s 2 columns, it doesn’t display entries after 100.

How can I fix this? I’ve scoured the docs and I see no limit=‘x’ capabilities.  I would appreciate any help you can offer!  I would prefer an unlimited amount per column, if possible.

(EE 1.6.7 Build 20090211)



Oliver:
2009-03-25 10:06

With 1.2.1 this should no longer be an issue.
Are you nesting one instance of Splitter inside another?



Nico:
2009-03-19 18:24

I’m getting “Notice: Constant PAGINATION already defined in D:\export\home\bigfellow.nl\system\plugins\pi.splitter.php on line 49” when using Splitter two or more times in one page.
Any solution for this?

EE version: 1.6.7

thanks