PageRenderTime 71ms CodeModel.GetById 66ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/smarty2/plugins/function.bind.php

http://zoop.googlecode.com/
PHP | 17 lines | 15 code | 1 blank | 1 comment | 5 complexity | f18b693c866d58d47d30b8760465158c MD5 | raw file
 1<?php
 2function smarty_function_bind($params, &$smarty)
 3{
 4	assert(isset($params['data_object']));
 5	// handle the data bindings
 6	if(!isset($params['data_field']))
 7		trigger_error("gui:bind: if you specifiy a data object you must also specify a data field");
 8	if(!isset($smarty->pehppy->form))
 9		trigger_error("gui:bind: if you specifiy a data object you must first use the 'init_form' tag");
10	
11	$object = $params['data_object'];
12	$field = $params['data_field'];
13	if(isset($params['assign']))
14		$smarty->assign($params['assign'], $smarty->pehppy->form->addBinding(get_class($object), $object->getId(), $field));
15	else
16		return $smarty->pehppy->form->addBinding(get_class($object), $object->getId(), $field);
17}