/** * 默认动作 * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参 * 对于如下的例子, 当访问http://yourhost/y/index/index/index/name/yantze 的时候, 你就会发现不同 */ public function indexAction() { $site = new OptionModel(); $product = new ProductModel(); $page = $this->getRequest()->getQuery("page"); $size = $this->getRequest()->getQuery("size"); if (!($page && $size)) { $page = 1; $size = 12; } $itemlist = $product->selectPage($page, $size); $maxNum = $product->selectAll_num(); $siteInfo = $site->selectAll(); $this->getView()->assign("name", $siteInfo[0]['value']); $this->getView()->assign("desc", $siteInfo[1]['value']); $this->getView()->assign("items", $itemlist); $this->getView()->assign("maxNum", intval($maxNum)); $this->getView()->assign("curPage", intval($page)); $this->getView()->assign("curSize", intval($size)); return true; }
public function getSettingsGroups() { return OptionModel::where('key', 'settings.groups')->firstOrFail()->value; }
public function loadOption() { Model::autoloadModel('Option'); $model = new OptionModel($this->db); $model->loadOption(); }
/** * Remove an option * * @param string $name The name of the option, formatted like : <plugin>.<key> */ public static function delete($name) { list($plugin, $key) = explode('.', $name); OptionModel::deleteByExample(new DBExample(array('plugin' => $plugin, 'key' => $key))); }