当前位置: 首页>>代码示例>>PHP>>正文


PHP Software::find_by_query方法代码示例

本文整理汇总了PHP中Software::find_by_query方法的典型用法代码示例。如果您正苦于以下问题:PHP Software::find_by_query方法的具体用法?PHP Software::find_by_query怎么用?PHP Software::find_by_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Software的用法示例。


在下文中一共展示了Software::find_by_query方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _init_software

 /**
  *	@fn _init_software
  *	@short Private method that initializes repetitive members of software product page actions.
  */
 private function _init_software()
 {
     $conn = Db::get_connection();
     if (isset($_REQUEST['software_name'])) {
         $software_factory = new Software();
         $softwares = $software_factory->find_all(array('where_clause' => '`name` = \'' . $conn->escape($_REQUEST['software_name']) . '\' AND `type` = \'' . $conn->escape($_REQUEST['software_type']) . '\'', 'limit' => 1));
         if (count($softwares) > 0) {
             $this->software = $softwares[0];
         } else {
             $softwares = $software_factory->find_by_query('SELECT `softwares`.`id` ' . 'FROM `softwares` ' . 'LEFT JOIN `software_typos` ON `softwares`.`id` = `software_typos`.`software_id` ' . 'WHERE `software_typos`.`typo` = \'' . $conn->escape($_REQUEST['software_name']) . '\' ' . 'LIMIT 1');
             if (count($softwares) > 0) {
                 $this->software = $softwares[0];
                 header(sprintf('Location: http://%s%s', $_SERVER['HTTP_HOST'], $this->software->url_to_detail($_REQUEST['subview'])));
                 exit;
             } else {
                 HTTP::error(404);
             }
         }
         $_REQUEST['id'] = $this->software->id;
     } else {
         if (isset($_GET['id'])) {
             $this->software = new Software();
             if ($this->software->find_by_id($_GET['id']) === FALSE) {
                 $this->flash(l('No such software product!'), 'error');
                 $this->redirect_to(array('action' => 'index'));
             }
         } else {
             HTTP::error(404);
         }
     }
     $this->software->has_many('software_releases', array('where_clause' => '`released` = \'1\''));
     $releases = $this->software->software_releases;
     usort($releases, array($releases[0], 'sort_releases'));
     $this->release = $releases[0];
     $this->software->software_releases = $releases;
     Db::close_connection($conn);
 }
开发者ID:emeraldion,项目名称:zelda,代码行数:41,代码来源:software_controller.php


注:本文中的Software::find_by_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。