Donal.Lynch.Msc
Donal.Lynch.Msc

Reputation: 3615

converting php scripts into cakephp

Any good resources on this?

Ideally a tutorial or walkthrough of an application being designed from the ground up or even just tutorials on the inns and outs of the framework.

I have a lot of php scripts and jquery is used to update various containers on the page. I have the Auth Module working and the homepage is displaying, but where do i start in terms of converting all those php scripts into MVC compliant code?

Currently, the majority of my scripts work similar to this example:

$.post('/scripts/getUserInfo.php', { id:id },
    function(output){
        $('div#user_info_container').html( output );
    }
);

QUESTION:

What are the steps involved in creating MVC compliant code from php scripts? Do you start by writing a controller for each script?

Am relatively new to Cake so any advice appreciated guys...

Upvotes: 0

Views: 516

Answers (1)

Jacek Kaniuk
Jacek Kaniuk

Reputation: 5229

Write one controller and create one action for every script, where You query data from DB. For each action You will have to add a view with html output from Your previous script.

But it very much depends on Your DB model structure - if Your scripts updates data from different tables, probably You should create actions in apriopiate controllers (connected with that table model).

You can check $this->isAjax() in You controller[s] and change render layout to minimalistic (without page layout)

Upvotes: 1

Related Questions