Hi,
I'm trying to use functions in vardefs to retrieve values for a custom module. The reference I used comes from the vardefs.php pdf documentation.
Following is what I've added:
vardefs.php:
property.php:PHP Code:'num_rooms' => array(
'source'=>'function',
'function_name'=>'get_num_rooms',
'function_class'=>'Property',
'function_params'=> array('id'),
'function_params_source'=>'this',
'type'=>'function',
'name'=>'num_rooms',
),
listview.htmlPHP Code:function get_num_rooms($property) {
$db = &PearDatabase::getInstance();
$query = "SELECT SUM(num_rooms) as sum_num_rooms FROM properties_roomtypes WHERE fldProperty='$property'";
$result = $db->query($query);
$row = $db->fetchByAssoc($result);
if ($row != null) return $row['sum_num_rooms'];
}
PHP Code:<td scope='row' valign=TOP class="{ROW_COLOR}S1" bgcolor="{BG_COLOR}"><slot>{PROPERTY.NUM_ROOMS}</slot></td>
What other files do I need to make modifications in order to get it to work?


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks