Jump to content

cakePHP newbie needs help


skein

Recommended Posts

so im doing this test application. I did everything step by step as said in the book:

 

- I created a table items

- i created a file item.php in models folder

 

<?php

class Item extends AppModel {

var $name = 'Item';

}

?>

 

-I created a items_controller.php in the controllers folder

<?php

class ItemsController extends AppController {

var $name = 'Items';

var $scaffold;

}

?>

 

But when I go to http://localhost/testapp/items it says Not Found, but the book says I should get a view rendered.

What did I do wrong. Can someone help me please?

 

Link to comment
Share on other sites

  • 2 weeks later...

I'm trying to install cake on my Debian based server and I'm running into some of the same issues which you're having however I'm pretty sure I know what's going on, just not how to solve it:

 

The first question I would ask is on your http://localhost/cake do you have a full color page with styles or a bear bones page?

 

from http://book.cakephp.org/view/326/the-cake-blog-tutorial

Occasionally a new user will run in to mod_rewrite issues, so I'll mention them marginally here. If the Cake welcome page looks a little funny (no images or css styles), it probably means mod_rewrite isn't functioning on your system. Here are some tips to help get you up and running:

 

So it sounds like you're having mod_rewrite issues as I am (see the link for other ways to diagnose this and possibly solve if you're using apache 1.*, I'm got apache2 going on my server and things are just in the httpd.conf file anymore so I'm hoping that someone has some experience changing mod_rewrite settings for cake on apache2

Link to comment
Share on other sites

I've actually figured out how to enable the mod_rewrite functionality on apache2 after searching around for a while, and now my first few cake applications seem to be working

 

Here's a few ways to test if your mod_rewrite is working correctly:

 

first take a look at your phpinfo(); and do a search for Loaded modules. you should see mod_rewrite in there - if not this is where your problem is

 

second test - Create a .htaccess file (a text file named .htaccess) with the following code in it in a subdir

 

Options +FollowSymLinks
RewriteEngine On

 

Save the file to a subdirectory of your main site something like this

/rewrite-testfolder/.htaccess

 

Now attempt to browse to the subdirectory (http://localhost/rewrite-testfolder/). One of two things could happen

 

- No errors Congrats mod_rewrite engine is enabled.

 

- 500, Internal Server Error If you get this message then mod_rewrite was not installed/enabled on your computer.

 

This is how I fixed it on my ubuntu / debian based servers running apache2

 

sudo a2enmod rewrite

in a terminal  window

 

this enabled the mod_rewrite module, upon refreshing the pages no more 500 server error and Cakes' tiny urls were working, also on the homepage of my cake installation everything was much more colorful and styled (at least on my umbuntu server) - these steps enabled the mod_rewrite on my debian server but didn't produce the colorful cake homepage so I'm still trying to find a solution

 

 

Link to comment
Share on other sites

Way to jack the thread pquery. :P

 

Skein, you have to create a view file for items. Go to app/views/ and add an items folder. Make index.ctp, and place your HTML/PHP you want displayed in the there. Then, example.com/items/ should show that index. Likewise, other functions in the controller should have their own view file in the items folder.

 

http://book.cakephp.org/view/10/Understanding-Model-View-Controller

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.