Yes, the file is in the cake/app/controllers/ dir.
Here is the code for the posts_controller.php:
class PostsController extends AppController
{
var $name = 'Posts';
function index()
{
$this->set('posts', $this->Post->findAll());
}
function view($id = null)
{
$this->Post->id = $id;
$this->set('post', $this->Post->read());
}
function add()
{
if (!empty($this->data))
{
if ($this->Post->save($this->data))
{
$this->flash('Your post has been saved.','/posts');
}
}
}
function delete($id)
{
$this->Post->del($id);
$this->flash('The post with id: '.$id.' has been deleted.', '/
posts');
}
}
function edit($id = null)
{
if (empty($this->data))
{
$this->Post->id = $id;
$this->data = $this->Post->read();
}
else
{
if ($this->Post->save($this->data['Post']))
{
$this->flash('Your post has been updated.','/posts');
}
}
}
?>
also the dir structure is like:
/usr/local/apache/htdocs/cake/
->cake
-> app
-> cake
-> docs
-> index.php
-> vendors
When I did the installation, I didn't change anything for the module
mod_rewrite.
Thanks,
S.
On Mar 7, 4:05 pm, "hydra12" <[EMAIL PROTECTED]> wrote:
> I could be wrong, but it sounds like cake is having trouble finding
> your posts_controller.php. I'm assuming that it's in cake/app/
> controllers/posts_controller.php? The class should be class
> PostsController extends AppController.
>
> Is that what you have? It might help if you could put your code up
> someplace so we could look at it.
>
> On Mar 7, 12:55 pm, "Somewhere" <[EMAIL PROTECTED]> wrote:
>
>
>
> > It's the default structure that comes directly out of the cake box. I
> > never changed it.
> > Is it what you need?
> > Thanks a lot!
>
> > On Mar 7, 1:40 pm, "hydra12" <[EMAIL PROTECTED]> wrote:
>
> > > What is your current directory structure? That would help in
> > > diagnosing your problem.
>
> > > On Mar 7, 12:06 pm, "Somewhere" <[EMAIL PROTECTED]> wrote:
>
> > > > Yes, thank you for the reply! I have succesfully installed Cake now.
> > > > I followed the online example of Blog and created the DB and the code.
> > > > But when I tried to connect to it, I got this fatal error:
>
> > > > Fatal error: Class 'PostsController' not found in /usr/local/apache2/
> > > > htdocs/cake/cake/dispatcher.php on line 158
>
> > > > I did change the routes.php file like this:
>
> > > > // $Route->connect('/', array('controller' => 'pages', 'action'
> > > > => 'display', 'home'));
> > > > $Route->connect ('/', array('controller'=>'posts',
> > > > 'action'=>'index'));
>
> > > > The Dir root for the cake on the server is:
> > > > /usr/local/apache/htdocs/cake
>
> > > > (The defaulty wwwroot is /usr/local/apache/htdocs for that server.)
>
> > > > I have no clue about what is wrong with the code now since I am really
> > > > a freshman in the bakery.
>
> > > > Thanks a lot!
>
> > > > On Mar 7, 11:23 am, "Christopher E. Franklin, Sr."
>
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > You are going to have to read the installation instructions again all
> > > > > the way through as well as the manual onwww.cakephp.org
>
> > > > > On Mar 7, 7:46 am, "Somewhere" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Thank you, guys, for your help!
> > > > > > I just changed it to the dev installation and it works as it is.
> > > > > > But when I opened the default page in a browser, it said:
>
> > > > > > "Your database configuration file is not present."
>
> > > > > > Do you know what it refers to?
>
> > > > > > Thanks a lot!
> > > > > > S.
>
> > > > > > On Mar 6, 8:51 pm, "hydra12" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I don't know what your setup is like, but I explained to someone
> > > > > > > else
> > > > > > > how I do my alternative setup
> > > > > > > here:http://groups.google.com/group/cake-php/browse_thread/thread/8f96dbb2...
>
> > > > > > > I have a cake folder and an app folder inside my server's document
> > > > > > > root (htdocs for most people, it seems). I only had to change 1
> > > > > > > line
> > > > > > > in my app's webroot/index.php file to make it work. I hope it
> > > > > > > helps.
>
> > > > > > > hydra12
>
> > > > > > > On Mar 6, 3:53 pm, "Christopher E. Franklin, Sr."
>
> > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > I uploaded my bootstrap and core.php to the files section of
> > > > > > > > this
> > > > > > > >group:http://groups.google.com/group/cake-php/files?hl=en
>
> > > > > > > > The only thing I have changed in core.php was the DEBUG and the
> > > > > > > > CAKE_SESSION_SAVE' parts.
>
> > > > > > > > Change define('CAKE_SESSION_SAVE', 'database'); to
> > > > > > > > define('CAKE_SESSION_SAVE', 'php'); after you donwload it.
>
> > > > > > > > If you still get errors about require() your installation may be
> > > > > > > > corrupt. Try and re-download the latest version
> > > > > > > > fromwww.cakephp.org
>
> > > > > > > > On Mar 6, 1:07 pm, "Somewhere" <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > I just installed theCakePHPon the Apache 2.0 with PHP 5. I
> > > > > > > > > used the
> > > > > > > > > Alternative installation on theCakePHPmanual.
> > > > > > > > > However, when I tried to connect to the default page on a web
> > > > > > > > > browser,
> > > > > > > > > I got this error message:
>
> > > > > > > > > "Warning: require(config/core.php) [function.require]: failed
> > > > > > > > > to open
> > > > > > > > > stream: No such file or directory in
> > > > > > > > > /usr/lib/cake/cake/bootstrap.php
> > > > > > > > > on line 34
>
> > > > > > > > > Fatal error: require() [function.require]: Failed opening
> > > > > > > > > required
> > > > > > > > > 'config/core.php'
> > > > > > > > > (include_path='/usr/lib/cake:/home/ywang/cakephp/:.:/
> > > > > > > > > usr/local/lib/php') in /usr/lib/cake/cake/bootstrap.php on
> > > > > > > > > line 34"
>
> > > > > > > > > What might cause the problem? (I have set up the path in
> > > > > > > > > index.php
> > > > > > > > > file following the instructions on the manual.)
>
> > > > > > > > > Thanks a lot!- Hide quoted text -
>
> > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---