SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot t0WL337's Avatar
    Join Date
    Mar 2007
    Location
    Ottawa, Ontario!
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile CakePHP -> SitePoint tutorial HelpMePlz

    Okay so I am starting to learn about frameworks. I have decided to start with CakePHP and then learn probably Symfony.

    Here is the current tut I am working on (second page)
    http://www.sitepoint.com/article/app...ment-cakephp/2

    I am going through the tutorial on my computer using WAMP. Anyway, the problem is after creating the model and controller for the note app, the following does not happen..
    The $scaffold variable will trigger CakePHP's default scaffolding behavior: a fully-functional Notes section will be created, and will be accessible at http://localhost/notes/.
    What instead happens is that my browser can't grab localhost/notes because it does not exist. Which would make sense I suppose but I am having a hard time figuring this out.

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Whistler, Canada
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    app/controllers/notes_controller.php:

    PHP Code:
    <?php
    class NotesController extends AppController {

            public 
    $name 'Notes';
            public 
    $scaffold;

    }
    ?>
    app/models/note.php:

    PHP Code:
    <?php
    class Note extends AppModel {
            public 
    $name 'Note';
    }
    ?>
    If that's what you have it should work like a charm

    Cheers,
    Pepe

    Edit: I'm not sure I understood you correctly. Did you already have these scripts but is your problem related to the url not working?

  3. #3
    SitePoint Zealot t0WL337's Avatar
    Join Date
    Mar 2007
    Location
    Ottawa, Ontario!
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is public == var in php?

    (My dir structure is good, files are in right place and I am connecting to the db.)

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Whistler, Canada
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    var should work too

  5. #5
    SitePoint Zealot t0WL337's Avatar
    Join Date
    Mar 2007
    Location
    Ottawa, Ontario!
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Neither work. It cannot find this non-existant 'note' directory.

  6. #6
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is AllowOverride set to All in apache for .htaccess? You might want to set that then restart Apache. I have a feeling the mod rewrite rules aren't being applied.

  7. #7
    SitePoint Zealot t0WL337's Avatar
    Join Date
    Mar 2007
    Location
    Ottawa, Ontario!
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule    ^$    webroot/    [L]
        RewriteRule    (.*) webroot/$1    [L]
    </IfModule>
    root/cakePHP/.htaccess

    Okay, I figured out how to turn it on.. still getting an error, let me check it out and ill edit this post.

    Uh, oh; Missing controller

    You are seeing this error because controller NoteController could not be found.

    Notice: If you want to customize this error message, create app\views/errors/missing_controller.thtml.

    Fatal: Create the class below in file : app\controllers\note_controller.php

    <?php
    class NoteController extends AppController {
    var $name = 'Note';
    }
    ?>
    Oh, in the original script it seems that "class NotesController" should not be plural.

    The error is still happening, even when I try their suggested fix.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •