I couldn’t get the current stable version to work online, I think this is because of our .htaccess rules, subdomains and virtual hosting solution - but who knows…
Luckily, I stumbled (not using stumble, but Google) upon a post describing similar issues relating to sub-domain. This post discribed a bug fix, but also mentioned in an update that the fix was not required in the latest beta version of CakePHP. So I thought I’d give it a shot.
I’m very happy to say, the fix worked. But you’ll need to do a few amendments to the cakePHP blog tutorial for it to work in the Beta release. But the great part about the Beta release, is it tells you everything that you are doing wrong - so you don’t need this article… Just get into it.
They’ve added a form helper, which has meant the deprecation of several of the html helper methods, so add.thtml becomes:
<h1>Add Post</h1>
<form method="post" action="<?php echo $html->url('/posts/add')?>">
<p>
Title:
<?php echo $form->text('Post/title', array('size' => '40'))?>
<?php echo $form->error('Post/title', 'Title is required.') ?>
</p>
<p>
Body:
<?php echo $form->textarea('Post/body', array('rows'=>'10')) ?>
<?php echo $form->error('Post/body', 'Body is required.') ?>
</p>
<p>
<?php echo $form->submit('Save') ?>
</p>
</form>
and edit.thtml becomes:
<h1>Edit Post</h1>
<form method="post" action="<?php echo $html->url('/posts/edit')?>">
<?php echo $form->hidden('Post/id'); ?>
<p>
Title:
<?php echo $form->text('Post/title', array('size' => '40'))?>
<?php echo $form->error('Post/title', 'Title is required.') ?>
</p>
<p>
Body:
<?php echo $form->textarea('Post/body', array('rows'=>'10')) ?>
<?php echo $form->error('Post/body', 'Body is required.') ?>
</p>
<p>
<?php echo $form->submit('Save') ?>
</p>
</form>
There are a couple of other changes, for example you are recommended to change the security.salt for your application in the file cake/app/config/core.php, just slap some random sequence in here. Configure::write(’Security.salt’, ‘RandomStringofLettersAndNumbers’)
The database array has some extra options:
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'port' => '',
'login' => 'user',
'password' => 'password',
'database' => 'database_name',
'schema' => '',
'prefix' => '',
'encoding' => ''
);
And the routes.php should be changed to:
Router::connect ('/', array('controller'=>'posts', 'action'=>'index'));
Update: You can check out the code from our subversion source repository, it looks a lot better there. The project copies the edited files over a clean CakePHP installation. It also uses Ant to configure the site specific settings, so you can use the same files for Local and Server deployments, without writing request logic overhead into your code.
Last 5 posts by James Little- Drew Ginn resting after the Olympics - September 8th, 2008
- Sneakerplay: The social network for sneakers? - September 8th, 2008
- The Waikato Great Race 2008 - September 7th, 2008
- Facebook about to introduce adult content? - September 4th, 2008
- Gradjobs New Zealand is live - September 2nd, 2008










The Waikato Great Race 2008
Cuil - We’ll be back
Tomcat JRE_HOME setting
Tomcat JRE_HOME setting
Jagged/Multi dimensional Arrays (C# Programming Guide)
Jagged/Multi dimensional Arrays (C# Programming Guide)
Jagged/Multi dimensional Arrays (C# Programming Guide)
Sandpress sandbox wordpess theme
Facebook maintenance
Jagged/Multi dimensional Arrays (C# Programming Guide)
One Trackback
CakePHP 1.2.0.6311 beta blog tutorial…
You’ll need to do a few amendments to the cakePHP blog tutorial for it to work in the Beta release. But the great part about the Beta release, is it tells you everything that you are doing wrong - so you don’t need this article… Just get into it….