Page 1 of 1

[SOLVED] use CGSmartImage within a UDT

Posted: Wed Oct 09, 2013 6:57 pm
by uloloi
I have not found the way nor in a forum topic about using CGSmartImage within a User Defined Tag. Is it possible? How?

Re: use CGSmartImage within a UDT

Posted: Wed Oct 09, 2013 7:48 pm
by Rolf

Re: use CGSmartImage within a UDT

Posted: Wed Oct 09, 2013 8:16 pm
by uloloi
Pretty nice!, very useful ... thanks Rolf

Just something else. I needed to print a html tag, so instead of use smarty->display use display->fecth to compose a string

................
$str .= "<div rel='" . $key ."' class='huge-slide mi-".$theme_class."'";
$str .= "data-cycle-...";
$str .= ">\n"; // end div
$img_data = "{CGSmartImage src='".$val['img1']."' filter_watermark=1}";
$fetch_img = $smarty->fetch('eval:'.$img_data);
$str .= $fetch_img; // "<img src='". $val['img1'] ."'>";
if(isset($val['overlay'])){$str .= "<div class='caption huge-slide mi-".$theme_class."'>".$val['overlay']."</div>";}
$str .= "</div>\n";


Thanks a lot!

Re: [SOLVED] use CGSmartImage within a UDT

Posted: Fri Oct 11, 2013 1:24 pm
by calguy1000
It's bad form to output html code from a UDT like that. That's what smarty is for. PHP is perfect for advanced logic. Smarty is for display level stuff.

ALL of that code could be done in a single GCB.