Hi,
I'm wondering if anyone can help.
I'm trying to create a little render of mark-up using the parse_template class and am a little stuck.
To demonstrate my crazy thinking, I have made the following array in my controller.
PHP Code:
$data = array(
'heading' => array(
array(
'item' => array(
array('html' => '<img src="{image}" alt="{alternative}" />', 'image' => 'source.jpg', 'alternative' => 'Hello wolrd'),
array('html' => '<img src="{image}" alt="{alternative}" />', 'image' => 'source.jpg', 'alternative' => 'Hello wolrd'),
),
),
),
'footer' => array(
array(
'item' => array(
array('html' => '<p>{value}</p>', 'value' => 'hello from the footer x1'),
array('html' => '<p>{value}</p>', 'value' => 'hello from the footer x2'),
),
),
),
);
and have the following tags in my
view:
Code:
{heading}
{item}
{html}
{/item}
{/heading}
I parse the template which outputs the following mark-up to my browser which in theory is correct, however I want to go a step further and then have it replace {image}, {alternative}, and {value} with the value from the array. Its kind of like a double parse. I've tried to get it working using parse_string without success. Any ideas much appriciated.
Code:
<img src="{image}" alt="{alternative}" />
<img src="{image}" alt="{alternative}" />
<p>{value}</p>
<p>{value}</p>
Regards,
MoFish