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 >

Forrest Anderson:
2012-01-31 02:53

Hi,

I enjoy splitter but I am not able to load pages with splitter on it since updating to EE 2.4 are you aware of any problems with it?

Please let me know.

Thanks.



Courtney:
2010-11-22 18:36

Is there a way that the blocks could be set to unlimited?  I just want to put commas between a list of items—and I don’t really care how many there are.



valerydc:
2010-10-22 08:17

Would be nice to have two more params: first_class and last_class to make next markup

{exp:splitter blocks=“3”
    delimiter=”</li>”
    class=“span-6”
    block_start=”<ul>”
    block_end=”</ul>”
    first=“first”
    last=“last”}

<div class=“span-6 first”>
<ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ul>
</div>
<div class=“span-6”>
<ul>
  <li>Four/li>
  <li>Five</li>
  <li>Six</li>
</ul>
</div>
<div class=“span-6 last”>
<ul>
  <li>Seventh/li>
  <li>Eight</li>
  <li>Nine</li>
</ul>
</div>

Other strategy to use “switch” tag



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.