I'm running Expression Engine 2.3.0 and using the Channel Images add on.
Part of the site is complex enough that I'm doing it via a plugin rather than using EE's template logic. What I've essentially got is a CodeIgniter controller and views that's called on the site using an EE template tag that I specify.
I'd like to use channel images to make the channel data I'm displaying in my views look a little nicer. Problem is... the Channel Images function doesn't seem to allow me to call it as PHP. Because of the EE template parameters.
So, I decided I'd try to run a template block through the parser. But I'm not getting a result. Any ideas? Or maybe a workaround to call the function directly?
<?php $this->EE =& get_instance();
$img_tpl = '{exp:channel_images:images entry_id="'. $item['id'] .'" cover_only="yes"}
<div style="float:left; display:inline; width:125px;">
<a href="{image:url:large}" title="{image:title}"><img src="{image:url:small}" alt="{image:title}" /></a>
<p>{image:description}</p>
</div>
{/exp:channel_images:images}';
$opts = array('');
$img = $this->EE->output->set_output($this->EE->TMPL->parse_variables($this->EE->TMPL->parse_globals($img_tpl), array($opts)));
?>
You're going to have a hell of a time here. No part of EE's front-end parsing is written thinking that it will be called from outside of EE.
parse_variables()
and parse_globals()
don't parse full EE tag pairs (only individual variables), which is why you're getting no results.
I'd really recommend making this work with EE templates.