开发者

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 wh开发者_运维知识库ere 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...


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜