Jump to content

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
https://forums.phpfreaks.com/topic/149423-cakephp-newbie-needs-help/
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

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

 

 

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

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.