Category: Tambo
Hello Agavi-World! (Removing the default route)
In the previous step we created our agavi project. Now we'll add some life!
Like defined in the previous step, the default action is Default.Index. As we just want to make a simple Hello World for that page, we head over to tambo/app/modules/Default/templates/IndexSuccess.php and change it's content to
2
3
echo 'Hello World!';
?>
But if we visit http://localhost/ws/tambo/pub/ we still see the agavi logo! Open app/config/routing.xml and remove the 5th and 6th line stating:
2
<route pattern=”” module=”%actions.default_module%” … />
If we head over to http://localhost/ws/tambo/pub/ now, we see the brand new "Hello World!". Not so amazing :(. Don't worry, you just saw the rain drop on top of the tip of the ice berg.
Wizards! Creating the Agavi-Project
After we set up our agavi + propel libraries for the new project we want to create the project from scratch. Thatswhy we will not use the “agavi project-wizard” command but use “agavi project” instead.
2
3
4
Agavi > project-wizard
Agavi > project-create
Project base directory [/home/jan/workspacePhp/tambo]:
We'll just hit [return], since that's exactly where the project should be.
We may choose any name here, it's just for the stats/config. My example assumes Tambo.
Agavi already created a prefix which fits well, so hit [return].
Yes, we're fine with .php as extension for templates (hit [return]).
This is the path, which will be used if you access the project on your webserver. In my case the project will be accessible at http://localhost/ws/tambo/ so I fill /ws/tambo/pub/ . If you have any other folder, like http://localhost/ tambo you use /tambo/pub/. As you may see the project itself will have a folder pub, we'll look at that later. Now I hope you got an idea on how that document root is build.
We'll create the modules later, so we hit [return].
Now, follows the project creation task. As soon as you are skilled with Agavi and already know what Modules/Models/Views/Actions you want to create, you'll get how to fill these fields. For the start: It's not important and not a problem, if you just keep the default!
Laters! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Fine! Hit [return].
Our project is now created. When we had over to our directory with the browser ( http://localhost/ws/tambo/pub/ ) we'll see our new application! Well done!
(non)PEAR installation for Agavi and Propel
There are two ways to create an agavi project using propel.
1. Pear-Way:
1.1 Install propel:
2
pear install channel://pear.phpdb.org/phpdb/propel_runtime
1.2 Install agavi:
1.3. For each project, you create a new folder and run:
2. The custom way (later for deploying entire application + libs):
2.1 Create a new folder "myproject".
2.2 Create a sub folder myproject/libs and myproject/libs/propel and also myproject/libs/agavi
2.3 Download agavi's and propel's latest release* and paste the contents of the .zip/.tar.gz files in the corresponding directory.
2.4 Copy either myproject/libs/agavi/bin/agavi-dist to myproject/agavi (on linux/mac) or copy myproject/libs/agavi/bin/agavi.bat-dist to myproject/agavi.bat (on windows)
2.5 Create the project with :
a) Windows:
b) Linux/Mac:
2.6. Open the agavi(.bat) file and change AGAVI_SOURCE_DIRECTORY to libs/agavi/src (or on windows libs\agavi\src)
I suggest you use the project-wizard helper only if you already know all the modules/actions you want to create. You can easily add them later with other helpers!
* Of course you can checkout also the latest svn from agavi's https://svn.agavi.org/branches/1.0 or propel's http://svn.phpdb.org/propel/trunk


