Start a series of posts how to code apps. First ever app with AngularJS and Yii was very simple. We'll talk about a few topics. Demos find here Simple Single Page app with lots of data about Racing. I didnot write backend for it, because formatting JSON used in the app wasn't as simple.U can only browse list and details - without reloading the page ;) In AngularJS files u might find where the docs are downloaded. Folder with all oof the front (AngularJS files) looked like this (In images folder glyphicons.png files located):
Start a series of posts how to code apps. First ever app with AngularJS and Yii was very simple. We'll talk about a few topics. Demos find here Simple Single Page app with list of todos - u can browse, add and delete without reloading the page ;) Folder with all oof the front (AngularJS files) looked like this:
First ever lines of code in Py. For testing go to cloud www.codesculptor.org and paste the code in canvas, then press run. Another implementation of Spaceship - program template for RiceRocks - last project in the course. Week 7 - 8.
This widget will show a Facebook "like" button and "comments" box together with "tweet" button and "google plusone" button on your page.
- Textbox → Dropdownlist
- Dropdownlist → Dropdownlist
- Textbox → Textbox
- JS code and action
- Table row as a FORM
- List Item
Создание виджета WordPress похоже на построение плагина, но является более простым и явным процессом. В простейшем случае понадобится один файл, в котором будет находиться весь код PHP. Для организации виджета требуется три основных функции:
function widget() function update() function form()
Виджет CAutoComplete. Принцип создания поля довольно прост. На странице нужно поместить обычное текстовое поле и назначить событию onKeyUp обработчик, который будет отправлять AJAX запросы серверу. В этих запросах нужно передавать введённый посетителем текст. Сервер ищет совпадения с этим текстом в БД и возвращает результат браузеру. JavaScript обработчик создаёт список с вариантами, полученными от сервера, и показывает его под полем.
Pешение «в лоб»
$ids = array(1, 2, 3); $dataProvider=new CActiveDataProvider('User',array( 'criteria'=>array( 'condition'=>'id IN ('.implode(',', $ids).')', ) )); $this->render('admin',array( 'model'=>$dataProvider, ));
Говнокод выглядит не очень красиво; если массив $ids окажется пустым, возникнет ошибка; полученные значения нужно проверить. Далее решение с помощью библиотеки Yii.