Split Drupal content into two columns

Category
drupal
Date Created
25th Feb 2010
Last Updated
9th Jul 2010

Split Drupal content into two columns

Question

How to split Drupal content into two columns

Answer

The example below will split the variable $content into an array $column[0], $column[1] and so forth.

The split will occur where <span class="split"></span> is located.

$columns = preg_split('/<span class="split"><\/span>/i', $content);

To print the columns simply use:

print $column[0]
print $column[1]

Related terms