コード例 #1
0
ファイル: nodes.php プロジェクト: janssit/www.reliancelaw.be
 /**
  * Returns the node based on an alias and a table
  *
  * @param	string	$alias		Nodes alias to search for
  * @param	string	$table		Nodes table_name to search for
  * @param   string  $section	If table is categories, the section to search in 
  * @return	object 	The row object
  */
 public function findById($id, $table, $section = '')
 {
     //We need to add #__ as the prefix to allow translating of the query
     $query = $this->getDBO()->getQuery()->where('id', '=', $id);
     //Exception for categories
     if ($table == 'categories') {
         if (!empty($section)) {
             $query->where('section', '=', $section);
         } else {
             $query->where('section', '>', 0);
         }
     }
     $table = new KDatabaseTableDefault(array('table_name' => $table));
     $result = $table->fetchRow($query);
     return $result;
 }