Strict Standards: Only variables should be passed by reference in /home/olegadmin/n-professor.ru/docs/wp-includes/pomo/mo.php on line 184

Strict Standards: Only variables should be passed by reference in /home/olegadmin/n-professor.ru/docs/wp-includes/pomo/mo.php on line 184

Deprecated: Non-static method WP_MatchesMapRegex::apply() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-includes/class-wp.php on line 207
Записки профессора » Yii примеры затруднений при входном пороге в освоение данного фреймворка.
Strict Standards: Only variables should be passed by reference in /home/olegadmin/n-professor.ru/docs/wp-includes/general-template.php on line 1643

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::LoadStyles() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 405
Главная > PHP > Yii примеры затруднений при входном пороге в освоение данного фреймворка.

Yii примеры затруднений при входном пороге в освоение данного фреймворка.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Deprecated: Non-static method CodeColorerOptions::ParseOptions() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 80

Deprecated: Non-static method CodeColorerOptions::PopulateDefaultValues() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 66

Deprecated: Non-static method CodeColorerOptions::FilterLanguage() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 102

Deprecated: Non-static method CodeColorerOptions::GetLanguageMappings() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 246

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 157

Deprecated: Non-static method CodeColorerOptions::ParseBoolean() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 173

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 69

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 72

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 75

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 78

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 81

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 84

Deprecated: Non-static method CodeColorerOptions::ParseMode() should not be called statically, assuming $this from incompatible context in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-options.php on line 87

Strict Standards: Only variables should be passed by reference in /home/olegadmin/n-professor.ru/docs/wp-includes/pomo/mo.php on line 184

Strict Standards: Only variables should be passed by reference in /home/olegadmin/n-professor.ru/docs/wp-includes/pomo/mo.php on line 184

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/thumbnail-viewer/wp-thumbnailviewer.php on line 78

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

yii порог вхождения

Здесь я опишу пару сложностей, с которыми я столкнулся при изучении Yii.

Подключение CSS и Javascript

И так, первая сложность заключалась в том, что я никак не мог понять, как подключить CSS и JavaScript. Оказывается тут все очень просто. Загвоздка у меня заключалась в том что стили подключаются в файлах типа layouts. То есть, если на странице нужны стили или JS то нужно подключать layouts, иначе не получится. А добавляется все очень просто, на странице нужно внести следующий код, и все подключится туда куда надо автоматически.

<?php
$cs = Yii::app()->clientScript;
$cs->registerCssFile(Yii::app()->theme->baseUrl . '/css/photo.css');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/jquery-1.4.4.min.js');
?>

theme – означает что стили подключаются из темы оформления. Но это другая история.

Работа с Базой данных (БД)

Да, тут у меня возникли большие сложности в непонимании объектного подхода к работе с БД. Но ничего, разобрался, втянулся, и знаете, очень понравилось =).  Суть в следующем, для каждой таблицы создается класс (модель), который имеет переменные сопоставимые с колонками в данной таблице. То есть, если в таблице user есть  колонка с названием name то у класса User будет переменная name.

И так немного о функциях для работы с БД. Для примера представим что у нас есть табличка user со столбцами name, login и id Где id первичный ключ. И модель User,  которая отвечает за эту таблицу.

Получить данные о данном пользователе с id=15

$user=User::model()->findByPk(15);

findByPk – находит строку по первичному ключу.

По аналогии так же есть

findAllByAttributes($attributes)

$attributes – атрибуты поиска

Пример

$userList=User::model()->findAllByAttributes(array('name'=>'Олег')) ;

Найдет всех пользователей с именем “Олег”

Вывести список пользователей можно так

<? foreach($userList as $user):?>
<? echo $user->name;?>
<? endforeach; ?>

Это еще не все сложности с получением данных =) но об этом дальше.

Сейчас посмотрим, как можно добавить данные.

Допустим при нажатии на кнопку нас перенаправляет на страницу site.ru/info/save

То есть вызывается контролер Info и метод в нем actionSave

Пусть передаются туда методом POST имя пользователя

function actionSave()
{
$user=new User;
$user->name=$_POST[‘name’];
$user->save();
}

Вот мы и добавили нового пользователя

Что бы изменить информацию о пользователе нужно сделать так

function actionSave()
{
 $user= User::model()->findByPk($_POST['id']);
 $user->name=$_POST['name'];
 $user->save();
}

То есть $user здесь уже отвечает за конкретную строку таблицы

Удалить записи можно по аналогии

User::model()->deleteAllByAttributes(array(
'id' => array(1,2,3,4,5,6,7)
));

Ну пока на этом все, кое что я вынесу в другие статьи, и еще буду обновлять эту.

Поделиться в соц. сетях

Опубликовать в Google Buzz
Опубликовать в Google Plus
Опубликовать в LiveJournal
Опубликовать в Мой Мир
Опубликовать в Одноклассники
Опубликовать в Яндекс

PHP , ,

  1. Leamm
    20 Янв 2011 из 23:34 | #1

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    В yii встроена библиотека jquery, так что вместо
    $cs->registerScriptFile(Yii::app()->baseUrl . ‘/js/jquery-1.4.4.min.js’);
    правильнее
    $cs->registerCoreScript(‘jquery’);
    чтобы избежать конфликтов, вызванных множественным подключением библиотеки из разных мест

    • 22 Янв 2011 из 21:15 | #2

      Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

      Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

      Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

      Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

      Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

      Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

      Да, спасибо, за уточнение. Так действительно правильней.

  2. 30 Янв 2011 из 22:20 | #3

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    прочитал оба ваших поста о фреймворке, согласен абсолютно! особенно касаемо того что сперва изумляешься что за 10 минут построен красивый сайт, и очень грамотная структура за тебя продумана. Так и кажется что счас начнешь писать в 10 раз быстрее чем прежде. а потом ступор, и тратишь 3 дня на то, что сделал бы ранее за 3 часа))) да, и на форуме мне вопрос тоже пришлось задать, ибо мануал как бы сказать, с упущенными мелочами, из-за которых как раз ступор нступает.

    пишите еще пожалуйста, буду читать, добавил в закладки. а то я пока вникнуть не могу до конца.
    а, еще такой вопрос. Ну сейчас то уже прошло пару месяцев как вы осваиваетесь. ну как, овчинка стоит выделки?

  3. 30 Янв 2011 из 22:23 | #4

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    >>овчинка стоит выделки?
    я имею ввиду именно скорость разработки, для меня это важнее всего

  4. 31 Янв 2011 из 0:30 | #5

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    Да, я думаю стоит.
    Чем больше узнаю фреймворк, тем больше он мне нравится!
    На счет скорости разработки, я переделал 1 проект на полностью Yii, за то же самое время за которое написал его с нуля, а я очень долго разбирался со всякими мелочами! Так что теперь такой же проект напишу в разы быстрей.

    Скорость разработки возрастает в арифметической прогрессии по ходу знакомства с уже готовыми виджетами, и модулями.
    Вот к примеру модуль регистрации пользователей, раньше бы я писал его, а теперь подключил модуль, и все готово =)

    Я сейчас делаю еще 1 проект, как закончу, так подытожу свои знания об Yii.

  5. 31 Янв 2011 из 1:17 | #6

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    сенкью. пожалуй, действительно лучше день потерять потом за час долететь

  6. 19 Март 2011 из 16:28 | #7

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    YII – лучший framework. Потратьте два дня на изучение и Вы поймете насколько он простой и гибкий.

  7. 29 Ноя 2013 из 19:55 | #8

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    Спасибо за интересную статью. Очень помогла в работе.

  8. роман
    01 Июнь 2014 из 10:02 | #9

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallBeforeHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 214

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 49

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

    Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method CodeColorerLoader::CallAfterHighlightCodeBlock() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-includes/plugin.php on line 170

    Strict Standards: Non-static method CodeColorer::GetInstance() should not be called statically in /home/olegadmin/n-professor.ru/docs/wp-content/plugins/codecolorer/codecolorer.php on line 222

    Хорошо расписано. По прошествии стольких лет уже гуру. А статью продолжить бы. На чистом пхп делаю сайты, а yii никак из-за этих мелочей не могу освоить. Например в таблице user есть поле group, где номер группы. И таблица с перечислением групп groupps, с полями grid, grname. Как в контроллере получить пользователя и имя группы?

  1. Трекбеков пока нет.