zen of coding

Changing model's table from the controller

For one reason, or another you might wish to change your Model’s table on the fly… It would seem that it should be quite easy to do with: $this->Company->useTable = ‘another_company_table’; …but it’s not going to work… Instead, in your controller, use: $this->Company->table = ‘another_company_table’; I haven’t checked to see[…]

Read More »

Get yourself a new home (alternative to home.ctp)

I’m sure you know that to modify your application’s homepage, one needs to edit/create the home.ctp file in app/views/pages/home.ctp. That, however, leaves you dealing with a more or less static page… One common option to add some other functionality to your otherwise static pages is to copy the Pages Controller[…]

Read More »

A little something about the Form Helper…

Just a quick pointer about the form helper usage… If you don’t like the default output of $form->input(); echo $form->input(‘SomeModel.some_field’); //which produces: <div class="input text">    <label for="SomeModelSomeField">Some Field</label>    <input name="data[SomeModel][some_field]" type="text" value="" id="SomeModelSomeField" /> </div> Mainly the div’s, it produces, you can of course turn them off by[…]

Read More »
%d bloggers like this: