[eluser]Matthew Pennell[/eluser]
Never mind, I made my own; here it is, in case anyone else ever needs the same thing:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* MY_Parser Class
*
* @package CodeIgniter
* @subpackage Libraries
* @category MY_Parser
* @author Matthew Pennell
*/
class MY_Parser extends CI_Parser {
/**
* Parse a tag pair
*
* Parses tag pairs: {some_tag} string... {/some_tag}
*
* Also parses flat arrays, using {__value__} as a placeholder
*
* @access private
* @param string
* @param array
* @param string
* @return string
*/
function _parse_pair($variable, $data, $string)
{
if (FALSE === ($match = $this->_match_pair($string, $variable)))
{
return $string;
}
$str = '';
foreach ($data as $row)
{
$temp = $match['1'];
if (is_array($row))
{
foreach ($row as $key => $val)
{
if ( ! is_array($val))
{
$temp = $this->_parse_single($key, $val, $temp);
}
else
{
$temp = $this->_parse_pair($key, $val, $temp);
}
}
}
else
{
$temp = $this->_parse_single('__value__', $row, $temp);
}
$str .= $temp;
}
return str_replace($match['0'], $str, $string);
}
}
?>
So now this:
Code:
$data['countries'] = array('England', 'Ireland', 'Scotland', 'Wales');
can be passed to the Parser library and output using this kind of thing:
Code:
<ul>
{countries}
<li>{__value__}</li>
{/countries}
</ul>