*/ /** * patTemplate-function to display rendered datasource * * Simple template function to add datasource * * @version 0.2.0 * @package Wombat * @subpackage patTemplate */ class patTemplate_Function_Datasource extends patTemplate_Function { /** * name of the function * @access private * @var string */ public $_name = 'Datasource'; /** * tell that this function has to be executed during runtime * @var string */ public $_type = PATTEMPLATE_FUNCTION_RUNTIME; /** * template engine * @var patTemplate */ protected $tmpl; /** * call the function * * @access public * @param array $params parameters of the function (= attributes of the tag) * @param string $content inside tag * @return string content to insert into the template */ public function call($params, $content) { // content must be the datasource $datasource = trim($content); if (empty($datasource)) { return ''; } $randy = WBClass::create('WBDatasource_Renderer_HTML'); $ds = WBClass::create('WBDatasource_View'); $ds->addVars($params); $ds->setRenderer($randy); $ds->render($datasource); return $randy->GetHtml(); } } ?>