Jump to content

Recommended Posts

Below is a try at hello world.

1. What url do I use to try to run it? (I'm getting 404 file not found errors)

2. Is this an ok way to do hello world?
 

This is c:\inetpub\wwwroot\cakephp\app\models\try2.php

<?php
   class Try2 extends AppModel
   {
   }
?>

This is c:\inetpub\wwwroot\cakephp\app\controllers\try2s_controller.php

<?php
   class Try2sController extends AppController
   {
      function try2s()
      {
         $test='hello world';
         $this->set('test',$test);
     }
}
?>

This is c:\inetpub\wwwroot\cakephp\app\views\try2s\try2s.ctp

<pre>
   <?php print_r($test)?>
</pre>

 

Link to comment
https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/
Share on other sites

What version of cake is used for?

 

Try to change the try2s_controller.php to Try2sController.php file and the view from try2s to Try2s directory.

 

app/Controller/Try2sController.php

class Try2sController extends AppController {
    
      function try2s() {
         $test='hello world';
         $this->set('test',$test);
     }
}

app/View/Try2s/try2s.ctp

<?php pr($test); ?>

app/Model/Try2.php

 class Try2 extends AppModel {

   }

Your name's convention is not very clear but that one should work.

 

EDIT: The path of the url should be something like: 

Edited by jazzman1

Thank you for writing.

 

1.3.2 is the version.

 

Made those changes you suggested and having the same problem of error 404.

It says requested url is http://localhost:80/cakephp/app/webroot/Try2s/try2s

and physical path is c:\inetpub\wwwroot\cakephp\app\webroot\try2s\try2s.

 

I can get the default page for cakephp from http://localhost/cakephp.

Windows 6.1.

 

Changed routes.php like in the CakePHP cookbook getting started section.

 

Now getting warnings about

access denied for my_sql_connect(),

supplied argument not valid for my_sql_select_db(), my_sql_get_server_info(), my_sql_query(),

cannot modify header information.

 

Does having a model there mean that a table with the name as the plural of the model name has to be there also?

 

and error about

missing database table try2s for model Try2 was not found.

 

When I take database.php and change it back to database.php.default, get

warnings about not finding database.php

and error about non existent data source default core/cake/libs/model/connection_manager.php.

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.