本文整理汇总了PHP中Links::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Links::find方法的具体用法?PHP Links::find怎么用?PHP Links::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Links
的用法示例。
在下文中一共展示了Links::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchAction
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = \Phalcon\Mvc\Model\Criteria::fromInput($this->di, "Links", $_POST);
$this->session->conditions = $query->getConditions();
} else {
$numberPage = $this->request->getQuery("page", "int");
if ($numberPage <= 0) {
$numberPage = 1;
}
}
$parameters = array();
if ($this->session->conditions) {
$parameters["conditions"] = $this->session->conditions;
}
$parameters["order"] = "id";
$links = Links::find($parameters);
if (count($links) == 0) {
$this->flash->notice("The search did not find any links");
return $this->dispatcher->forward(array("controller" => "links", "action" => "index"));
}
$paginator = new \Phalcon\Paginator\Adapter\Model(array("data" => $links, "limit" => 10, "page" => $numberPage));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
}
示例2: actionEdit
/**
* 编辑新闻
*
*/
function actionEdit()
{
$link_id = intval($this->_context->link_id);
//创建表单
$form = Form_Admin_Links::createForm('links', url('links/edit'));
$link = Links::find('link_id =?', $link_id)->query();
$form->import($link);
//是否是post提交 及通过验证
if ($this->_context->isPOST() && $form->validate($_POST)) {
try {
$link->changeProps($form->values());
$link->save();
return $this->_redirectMessage('编辑友情链接成功', '如果你不做出选择系统将自动跳转', url('links/index'), 3);
} catch (QValidator_ValidateFailedException $ex) {
$form->invalidate($ex);
}
}
$this->_view['form'] = $form;
$this->_viewname = 'edit';
}
示例3: links
public function links()
{
return Links::find(['conditions' => 'site_id = :site_id:', 'bind' => ['site_id' => $this->id]]);
}