Changeset 179
- Timestamp:
- 04/11/07 08:54:30 (2 years ago)
- Files:
-
- wiki/Tutorial-french.wiki (added)
- wiki/Tutorial-spanish.wiki (added)
- wiki/Tutorial.wiki (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wiki/Tutorial.wiki
r175 r179 1 #labels Featured,Phase-Implementation,Phase-Deploy,Tutorial2 1 = Creating a simple application using the Akelos Framework = 3 2 … … 51 50 }}} 52 51 53 And change the `#!/usr/bin/env php` at the beginning of these files `script/console`, `script/generate`, `script/migrate`, `script/setup` and `script/test` to you php binary path.52 And change the `#!/usr/bin/env php` at the beginning of these files `script/console`, `script/generate`, `script/migrate`, `script/setup` and `script/test` to your php binary path. 54 53 55 54 *Note for Windows users:* You will need to call the scripts from your application directory using the full path to your php.exe file like: … … 66 65 67 66 1. Create an Akelos application in a different folder and link it to the Framework libraries. 68 1. Start coding our application from this folder with the security implications that has making available to the visitors of your site all your Application models, views, 3rd party libraries and so on.69 70 As you might have guessed we go with the first option and willcreate a linked Akelos application which will only expose the public folder to the world. Changing the Framework paths is really simple in Akelos, all you have to do is define in your configuration file where each component is located, but we will leave this for a future tutorial about designing an application for distributing it.67 1. Start coding your application from this folder with the security implications that has making available to the visitors of your site all your Application models, views, 3rd party libraries and so on. 68 69 As you might have guessed you should go with the first option and create a linked Akelos application which will only expose the public folder to the world. Changing the Framework paths is really simple in Akelos, all you have to do is define in your configuration file where each component is located, but we will leave this for a future tutorial about designing an application for distributing it. 71 70 72 71 Assuming you’ve downloaded the framework to `HOME_DIR/akelos` and that you are inside the `akelos` directory you will check available options for setting up your new application by running … … 121 120 === Creating a database for your application === 122 121 123 Next thing you’ll need is to create a database your your application. If you intend to use SQLite on PHP5 skip this step.124 125 Creating a MySQL database is out of the scope of this tutorial so you might need to google how to do this on your system or just try this common scenario where we will create database for 3 different environments(production, development and testing).122 Next thing you’ll need is to create a database for your application. If you intend to use SQLite on PHP5 skip this step. 123 124 Creating a MySQL database is out of the scope of this tutorial so you might need to google how to do this on your system or just try this common scenario where you can create 3 different databases one for each different environment (production, development and testing). 126 125 127 126 {{{ … … 137 136 }}} 138 137 139 If you are on a shared hosted server you might need to create it from your hosting companycontrol panel.138 If you are on a shared hosted server you might need to create it from your hosting provider control panel. 140 139 141 140 === Generating the configuration file === … … 193 192 }}} 194 193 195 That’s enough for Akelos to create our database schema. If you just specify the column name, Akelos will default to the best data type based on database normalization conventions. If you want to have full control over your table settings, you can use [http://phplens.com/lens/adodb/docs-datadict.htm php Adodb Datadict syntax]194 That’s enough for Akelos to create your database schema. If you just specify the column name, Akelos will default to the best data type based on database normalization conventions. If you want to have full control over your table settings, you can use [http://phplens.com/lens/adodb/docs-datadict.htm php Adodb Datadict syntax] 196 195 197 196 Now we need to execute the installer with the command … … 204 203 205 204 *BOOKS TABLE* 205 206 206 {{{ 207 207 +--------------+--------------+------+-----+----------------+ … … 217 217 218 218 *AUTHORS TABLE* 219 219 220 {{{ 220 221 +-------+--------------+------+-----+----------------+ … … 230 231 Akelos follows the [http://en.wikipedia.org/wiki/Model-view-controller MVC design pattern] for organizing your application. 231 232 232 Akelos MVC diagram. 233 http://akelosframework.googlecode.com/svn/trunk/docs/images/akelos_mvc.png 233 234 234 235 === Your application files and the Akelos Naming conventions === … … 260 261 === Meet the Scaffold generator === 261 262 262 You will create a base skeleton for interacting with the *booklink* database created before. In order to get this skeleton quickly you can use the _scaffold generator_ like this263 You will generate a base skeleton for interacting with the *booklink* database created before. In order to get this skeleton quickly you can use the _scaffold generator_ like this 263 264 264 265 {{{ … … 272 273 }}} 273 274 274 This will generate a bunch of files and folder with code that really works!. Don’t trust me? Try it yourself. Point your browser to http://localhost/booklink/author and http://localhost/booklink/books to start adding authors and books. Create some records and come back for an explanation of what is going under the hood.275 This will generate a bunch of files and folders with code that really works!. Don’t trust me? Try it yourself. Point your browser to http://localhost/booklink/author and http://localhost/booklink/books to start adding authors and books. Create some records and come back for an explanation of what is going under the hood. 275 276 276 277 == The Akelos Workflow == … … 324 325 {{{ 325 326 <?php 326 327 class BookController extends ApplicationController 328 { 329 var $models = 'book, author'; // <- make this models available 330 331 // ... more BookController code 332 333 function show() 334 { 335 // Replace "$this->book = $this->Book->find(@$this->params['id']);" 336 // with this in order to find related authors. 337 $this->book = $this->Book->find(@$this->params['id'], array('include' => 'author')); 338 } 339 340 // ... more BookController code 341 } 327 class BookController extends ApplicationController 328 { 329 var $models = 'book, author'; // <- make this models available 330 // ... more BookController code 331 function show() 332 { 333 // Replace "$this->book = $this->Book->find(@$this->params['id']);" 334 // with this in order to find related authors. 335 $this->book = $this->Book->find(@$this->params['id'], array('include' => 'author')); 336 } 337 // ... more BookController code 338 } 342 339 }}} 343 340
