display properly and you would get a 404 error instead of cakes default
error.
I would recommend baking your first few controllers until you get used
to the various naming conventions.
To use bake on windows you must add the path to the cake console to your
windows path.
To do this is vista/windows 7 click control panel, then in the search
box on the top right type "environment variables" Click the option that
appears to change your environment variables. In the top box (these
variables are just for your user) click add.
Name: "PATH"
Value: "C:\wamp\www\cakephp\cake\libs\console;C:\wamp\bin\php\php5.3.0;"
Press OK, then press OK again to save your changes
ok... you only have to do that once
First you need to do is create a database in phpMyAdmin and make a table
with a field named "id" set as the primary key and auto increment, and a
few other fields to demonstrate the power of bake (whatever you want,
cake will auto detect the different types). Name your database as a
plural, lowercase form of your model. ie. if your model is Item, name it
items, if it is Story, name it stories
Now you can open the windows command prompt by clicking the start menu
and typing "cmd" and pressing enter.
Now type "cake bake". Enter the directory where you would like your new
app to be stored (most likely C:\wamp\www\your_app_name)
Follow the prompts to setup your database information
now navigate to the app directory that was created in the previous
stype, for example "cd c:\wamp\www\your_app_name"
type "cake bake all"
this will connect to your database and create default models,
controllers, and views based on the fields in your tables.
So if you have a table items, you will end up with
controllers/items_controller.php, models/item.php, and
views/items/index.ctp,add.ctp,view.ctp,edit.ctp
Bake also does some nice things like generating a random string for your
Security.salt value, etc.
Test it out by navigating in your webbrowser to
http://localhost/your_app_name/controller_name
I wrote this from linux so there may be a few typos/errors in the
commands I have told you for windows because I am writing this from
memory. I am sure there are better tutorials online for how to use the
cake console from windows.
Regardless I hope this helps, baking your basic framework is one of the
easiest ways to save time with CakePHP.
Dave
On Fri, 2009-11-27 at 04:24 -0800, foongoos wrote:
> I have the recent version of cake installed on my windows vista
> machine. To make things easier, I am using the WAMP application.
> I was able to get the green bars indicating that everything was
> working ok and the database set up went well too.
> My directory structure is D:/wamp/www/cakephp and local host is
> http://localhost/cakephp/
> Well, now I am stuck as I tried to work through a tutorial.
>
> In my folder D:/wamp/www/cakephp/app/models, I created a file
> "item.php"
> <?php
> class Item extends AppModel
> {
> var $name = 'Item';
> }
> ?>
>
> and in my folder D:/wamp/www/cakephp/app/contollers, I created a file
> "items_controller.php"
> <?php
> class ItemsController extends AppController {
>
> var $name = 'Items';
> var $scaffold;
> }
> ?>
>
> When I run http://localhost/cakephp/items, I get
> Error: ItemsController could not be found.
> Error: Create the class ItemsController below in file: app\controllers
> \items_controller.php
>
> My allowOveride is set to ALL and the load rewrite_module is un
> commented.
> I have a feeling my problem lies in the .htaccess docs and I tried to
> read the installation manual but there is a section that is not clear
> to me. Please see number 3 http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess
> Am I supposed to ad this code snippets to the httpd.conf doc ?
> Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment