當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Yii::Import方法代碼示例

本文整理匯總了PHP中Yii::Import方法的典型用法代碼示例。如果您正苦於以下問題:PHP Yii::Import方法的具體用法?PHP Yii::Import怎麽用?PHP Yii::Import使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Yii的用法示例。


在下文中一共展示了Yii::Import方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 public function init()
 {
     Yii::Import('application.widgets.kyiv.models.*');
     $dir = dirname(__FILE__) . '/assets';
     $this->assetsDir = Yii::app()->assetManager->publish($dir);
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($this->assetsDir . '/js/bootstrap.min.js');
     $cs->registerScriptFile($this->assetsDir . '/js/jquery.min.js');
     $cs->registerScriptFile($this->assetsDir . '/js/jquery-ui.min.js');
     $cs->registerCssFile($this->assetsDir . '/css/bootstrap.css');
     $this->assetsDir = Yii::app()->assetManager->publish($dir);
     $events = new Event();
     $events = $events->findAll();
     $gr = new EventTree();
     $tree = $gr->findAll("lang=:lang", array(":lang" => "ua"));
     $this->render('main', array('tree' => $tree, 'events' => $events));
 }
開發者ID:snipesn,項目名稱:UkrYama-2,代碼行數:17,代碼來源:Kyiv.php

示例2: actionIndex

<?php

Yii::Import('models.form.*');
class HeaderController extends CmsController
{
    // layouts
    public $layout = 'webroot.themes.admin.views.admin.content_app';
    // layout for this controller
    // general settings
    public function actionIndex()
    {
        $model = new Form_Headers();
        $setting = array();
        foreach (get_object_vars($model) as $key => $null) {
            $setting[$key] = $this->loadSetting($key);
            $model->{$key} = $setting[$key]->option_value;
        }
        if (isset($_POST['Form_Headers'])) {
            $transaction = Yii::app()->db->beginTransaction();
            try {
                $model->attributes = $_POST['Form_Headers'];
                if ($model->validate()) {
                    foreach (get_object_vars($model) as $key => $null) {
                        $setting[$key]->option_value = str_replace(Helper::rootImg('content'), '', $_POST['Form_Headers'][$key]);
                        if (!$setting[$key]->save()) {
                            throw new Exception($setting[$key]->getError('value'));
                        }
                    }
                    $transaction->commit();
                    $message = "<strong>Well done!</strong> You successfully Update Settings";
                    Yii::app()->user->setFlash('info', $message);
開發者ID:beckblurry,項目名稱:Yii1-Base-Core-V.Alpha.1,代碼行數:31,代碼來源:HeaderController.php


注:本文中的Yii::Import方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。