Jump to content

Archived

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

neginf

how to run hello world

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>

 

Share this post


Link to post
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: 

Share this post


Link to post
Share on other sites

Does your localhost run on an apache server or something else?

 

If you are using an apache server, could you show us the http.conf file.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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