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

smartpill:
2010-06-19 20:25

Hopefully I haven’t asked this before. Is there a way to use “switch” with this so I can apply a different class to the first split?



julie:
2010-06-18 19:50

aha. for some reason I thought the code put that in there automagically at the end of 3 elements. thanks!



Oliver:
2010-06-18 19:41

Well you set the delimiter to
but there are no
s in your loop so it will only output one block.



julie:
2010-06-18 18:57

Hey there. i’m trying to use this in my site. I have some simple code - literally the sample code:

{exp:splitter blocks=“3” delimiter=”<br />” class=“myclass”}
  {exp:weblog:entries weblog=“clients” order_by=“title” sort=“asc”}
    <li>{title}</li>
    {/exp:weblog:entries}
{/exp:splitter}

And it is spitting out:

<div class=“myclass”>
                 
        <li>asdfasdf</li>
                 
        <li>asdfasdf2</li>
                 
        <li>asdfasdf3</li>
                 
        <li>asdfasdf4</li>
                 
        <li>asdfsdf5</li>
                 
          <li>asdfasdf6</li>
                 
   
</div>

thanks! I’m using EE 1.6.9



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!