本文整理汇总了PHP中Pages::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::model方法的具体用法?PHP Pages::model怎么用?PHP Pages::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionFinduser
public function actionFinduser()
{
$result = array();
$result1 = array();
$data = $_POST['searchword'];
$user = UserProfile::model()->findAll('first_name LIKE :name', array(':name' => "%{$data}%"));
$page = Pages::model()->findAll('company_name LIKE :name', array(':name' => "%{$data}%"));
$result = array_merge($user, $page);
shuffle($result);
// foreach($result as $r):
// print_r($r['attributes']);
// endforeach;
// return;
foreach ($result as $u) {
$html = '<div class="display_box" align="left" style="position:relative; z-index:3;">';
if (isset($u['first_name'])) {
$id = $u['user_id'];
$img = $u['image'];
$html .= '<a href = "' . Yii::app()->baseUrl . '/index.php/user/viewprofile/userId/' . $id . '"><img src="' . Yii::app()->baseUrl . '/uploads/user_' . $id . '/' . $img . '"style=float:left; margin-right:6px; width=40 height = 40 />  <span style = "font-size:15px">' . $u['first_name'] . ' ' . $u['last_name'] . '<br/>';
$html .= ' <span style="font-size:9px; color:#999999">' . "USER" . '</span></div></a><br/>';
echo $html;
} elseif (isset($u['company_name'])) {
$id = $u['user_id'];
$img = $u['image'];
$html .= '<a href = "' . Yii::app()->baseUrl . '/index.php/businesspage/viewpage/' . $u->id . '"><img src="' . Yii::app()->baseUrl . '/uploads/business_page_' . $id . '/' . $img . '"style="float:left; margin-right:6px" width="40px"; height ="40px"; /> <span style = "font-size:15px">' . $u['company_name'] . ' </span>(' . $u['domain'] . ')<br/>';
$html .= '<span style="font-size:9px; color:#999999">' . "PAGE" . '</span></div><br/>';
echo $html;
}
}
}
示例2: actionSitemap
public function actionSitemap()
{
$pages = Pages::model()->findAll();
$news = News::model()->findAll();
header('Content-Type: application/xml');
$this->renderPartial('../site/sitemap', array('pages' => $pages, 'news' => $news));
}
示例3: actionIndex
public function actionIndex($id)
{
$model = Pages::model()->findByPk($id);
$model->url = mb_strtolower($model->url);
$model->url = str_replace("http://", "", $model->url);
header('Location: http://' . $model->url);
}
示例4: actionCreate
public function actionCreate()
{
//echo realpath(Yii::app()->baseUrl); return;
$model = new Pages();
$this->layout = 'layout_user';
// uncomment the following code to enable ajax-based validation
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='pages-create-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if (isset($_POST['Pages'])) {
$model->attributes = $_POST['Pages'];
if ($model->validate()) {
$page = Pages::model()->find('id=:p_id', array(':p_id' => Yii::app()->session['pageId']));
$page->company_name = $_POST['Pages']['company_name'];
$page->type = $_POST['Pages']['type'];
$page->address = $_POST['Pages']['address'];
$page->description = $_POST['Pages']['description'];
$page->save();
// form inputs are valid, do something here
return;
}
}
$this->render('create', array('model' => $model));
}
示例5: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$page = Pages::model()->findByPk(1);
$comments = Posts::model()->templates()->roots()->findAll();
$childrens = Posts::getCountChildrens($comments);
$this->render('index', ['page' => $page, 'comments' => $comments, 'childrens' => $childrens]);
}
示例6: actionIndex
public function actionIndex($id)
{
$model = Pages::model()->findByPk($id);
if (!$model || $model->status == 0) {
throw new CHttpException(404, 'The page can not be found.');
}
//Титл и SEO
$this->setSEO($model->url, mb_convert_case($model->title, MB_CASE_UPPER, "UTF-8"));
$this->layout = '//layouts/' . $model->main_template;
$modelCatalog = null;
$modelNews = null;
//Если главная - добавляю товары помеченые как на главную и новости
if ($model->main_page == 1) {
$modelCatalog = CatalogElements::model()->findAll('`status` = 1 AND `primary` = 1');
$modelNews = NewsElements::gatPrimaryNews();
}
//Проверка прав доступа
if ($model->access_lvl > 0) {
if (Yii::app()->user->isGuest) {
$this->redirect('/login');
}
}
//Проверяем есть ли фотогалерея, если есть - меняем содержимое страницы
$model->content = $this->addPhotogalery($model->content);
//Проверяем есть ли форма, если есть - меняем содержимое страницы
$model->content = $this->addForm($model->content);
//Получаем вкладки если есть;
$modelTabs = PagesTabs::model()->getTabsContent($id);
$this->render('index', array('model' => $model, 'modelTabs' => $modelTabs, 'modelCatalog' => $modelCatalog, 'modelNews' => $modelNews));
}
示例7: run
public function run()
{
$page_id = $this->page_id;
$controller = Yii::app()->getController();
$model = new ModuleList3();
if (!is_null($page_id) && Pages::model()->existsPage($page_id)) {
$this->create_item($page_id, $model);
$this->update_order($page_id);
$mpage_id = ModulesInPages::model()->getLink((int) $page_id, $this->module_id);
if ($mpage_id == 5) {
$mpage_id = 4;
}
if ($mpage_id == 54) {
$mpage_id = 4;
}
if ($mpage_id == 56) {
$mpage_id = 4;
}
if ($mpage_id == 58) {
$mpage_id = 4;
}
$params_list = ModuleList3Params::model()->getList($mpage_id);
$this->render('module_list3', array('model' => $model, 'params_list' => $params_list, 'page_id' => $page_id));
} else {
$controller->redirect(Yii::app()->request->scriptUrl);
}
}
示例8: setSEO
public function setSEO($url_patch, $page_title = null, $modelSEO = null)
{
$url_patch = trim($url_patch);
$this->pageTitle = (!empty($page_title) ? $page_title . ' - ' : '') . $this->pageTitle;
$url_array = explode("/", parse_url($url_patch, PHP_URL_PATH));
foreach ($url_array as $url) {
$model = Pages::model()->find('url LIKE "' . $url . '"');
if ($model) {
if (!empty($model->meta_title)) {
$this->pageTitle = $model->meta_title;
$this->pageMetaTitle = $model->meta_title;
}
if (!empty($model->meta_keywords)) {
$this->pageKeywords = $model->meta_keywords;
}
if (!empty($model->meta_description)) {
$this->pageDescription = $model->meta_description;
}
}
}
if (!empty($modelSEO)) {
if (isset($modelSEO->meta_title) && !empty($modelSEO->meta_title)) {
$this->pageTitle = $modelSEO->meta_title;
$this->pageMetaTitle = $modelSEO->meta_title;
}
if (isset($modelSEO->meta_keywords) && !empty($modelSEO->meta_keywords)) {
$this->pageKeywords = $modelSEO->meta_keywords;
}
if (isset($modelSEO->meta_description) && !empty($modelSEO->meta_description)) {
$this->pageDescription = $modelSEO->meta_description;
}
}
return true;
}
示例9: getPages
protected function getPages()
{
if (!$this->_pages) {
$c = new CDbCriteria();
$this->_pages = Pages::model()->findAll($c);
}
return $this->_pages;
}
示例10: run
public function run()
{
$criteria = new CDbCriteria();
$criteria->select = 'name, title';
$criteria->order = 'name';
$model = Pages::model()->findAll($criteria);
$this->render('widgetPages', array('model' => $model));
}
示例11: loadModel
public function loadModel($id)
{
$model = Pages::model()->not_deleted()->findByPk($id);
if (!$model) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例12: getAllAction
public function getAllAction()
{
$criteria = new CDbCriteria();
$result = Pages::model()->findAll($criteria);
if ($result) {
return CHtml::listData($result, 'slug', 'slug');
}
return array();
}
示例13: getNewsInfoForNavs
public static function getNewsInfoForNavs()
{
$news = Pages::model()->findAll('type=:type', array(':type' => 'news'));
$newsInfos = array();
foreach ($news as $new) {
$newsInfo = array('title' => $new->title, 'url' => Yii::app()->createUrl('admin/news', array('id' => $new->id)));
array_push($newsInfos, $newsInfo);
}
return $newsInfos;
}
示例14: actionLocal
public function actionLocal()
{
//$this->checkAccess('Admin');
$page = Pages::model()->find('alias=:alias', array('alias' => 'local'));
$this->pageTitle = $page->lang->title ? $page->lang->title : Yii::t('app', 'Локальный сервер');
$this->pageDescription = $page->lang->meta_description;
$this->pageKeywords = $page->lang->meta_keywords;
$this->layout = 'home';
$this->render('local', array('page' => $page));
}
示例15: run
public function run($page_name = 'index')
{
$dependency = new CDbCacheDependency("SELECT MAX(UNIX_TIMESTAMP(updated_at)) FROM {{pages}} WHERE page = :page AND status = :status AND lang = :lang");
$dependency->params = array('page' => $page_name, 'status' => ActiveRecord::STATUS_ON, 'lang' => app()->getLanguage());
$model = Pages::model()->cache(3600 * 24, $dependency)->opened()->find('page = :page AND lang = :lang', array('page' => $page_name, 'lang' => app()->getLanguage()));
if ($model === NULL) {
throw new CHttpException(404, Yii::t('main', 'Страница не найдена.'));
}
app()->getController()->render('//page', array('model' => $model));
}