Controller code is built in:

\cake\console\libs\tasks\controller.php

That’s where you need to make changes to bake custom controllers

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of MikeBates
Sent: Tuesday, 7 July 2009 12:10 p.m.
To: [email protected]
Subject: Re: Modify bakes rendered code



Thanks for the link, but it's not the views (HTML) I want to modify, it's
the
controller php code that bake creates.



Brendon Kozlowski wrote:
> 
>
http://book.cakephp.org/view/789/Modify-default-HTML-produced-by-baked-templ
ates
> :)
> 
> On Jul 6, 1:44 pm, MikeBates <[email protected]> wrote:
>> Does anyone know what I need to edit in the console code to modify the
>> default code that bake renders? As good as bake is I still find that I
>> need
>> to spend a lot of time going through all the code it creates for me
>> making
>> the same adjustments each time.
>>
>> Any hints on what needs to be done would be appreciated.
>>
>> AS an FYI, I'd like to do 2 things:
>>
>> Change the coding style to this
>>
>>         function foo()
>>         {
>>                 if( $bar == 1 )
>>                 {
>>                         $this->redirect( array( 'controller' => 'view' )
>> );
>>                 }
>>         }
>>
>> Modify the add method to include an ajax save for all controllers:
>>
>>         function add()
>>         {
>>                 if ( !empty( $this->data ) )
>>                 {
>>                         $this->Person->create();
>>
>>                         //ajax save
>>                         if( $this->RequestHandler->isAjax() )
>>                         {
>>                                 if( $this->Person->save( $this->data ) )
>> {
>>                                         $this->set( 'people',
>> $this->Person->find( 'list' ) );
>>                                         $this->view = 'Json';
>>                                         $this->set( 'json', 'people' );
>>                                 }
>>                                 Configure::write( 'debug', 0 );
>>                         }
>>
>>                         //standard save
>>                         else
>>                         {
>>                                 if ( $this->Person->save( $this->data ) )
>>                                 {
>>                                         $this->Session->setFlash( __(
>> 'The Person has been saved', true ) );
>>                                         $this->redirect(array( 'action'
>> => 'index' ) );
>>                                 }
>>                                 else
>>                                 {
>>                                         $this->Session->setFlash( __(
>> 'The Person could not be saved. Please,
>> try again.', true ) );
>>                                 }
>>                         }
>>                 }
>>         }
>> --
>> View this message in
>>
context:http://www.nabble.com/Modify-bakes-rendered-code-tp24358859p24358859
....
>> Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Modify-bakes-rendered-code-tp24358859p24365043.html
Sent from the CakePHP mailing list archive at Nabble.com.




__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4219 (20090705) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4219 (20090705) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4219 (20090705) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to