/    Sign up×
Community /Pin to ProfileBookmark

Help with MVC structure

Hi

I’ve been working on a little php application that is written in the good old fashion where php and html is in the same file.

Now I wan’t to rewrite the app to get the MVC structure and I’ve mad a simple framework to this purpose. But I have one question regarding the structure:

In the current app I have a file called Client.php and a file Client_action.php.
The Client_action.php is loaded into Client.php through a Iframe, and handles all actions like showing details, filling forms and so on. In this way I prevent the main page to reload all the time.

How do I do this in the MVC structure?

I should have a Client_Controller.php, a Client_Model.php and a Client_View.php, but what about the Client_action.php that I like to load into Client_Controller.php through a Iframe? (I have to be able to load it into other controllers).
Should I make a Client_action_Model.php and View to this, and load it through Client_Controller.php? (some kind of sub model)

Hope it’s understandably!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 07.2010 — Not sure I'm crazy about the whole iframe concept (you might be exempting many mobile browsers), but since an iframe is essentially a separate web page, I would probably design/implement the iframe within your framework as such, with its own controller and view (and using whatever models it needs).
Copy linkTweet thisAlerts:
@dbkauthorNov 09.2010 — Not sure I'm crazy about the whole iframe concept (you might be exempting many mobile browsers), but since an iframe is essentially a separate web page, I would probably design/implement the iframe within your framework as such, with its own controller and view (and using whatever models it needs).[/QUOTE]

What should I use instead of iframes??

Should I go for <div> and innerhtml and updating with javascript?

My project is a application to be used from a computer, and the smartphones and other devices is not a part of the game.
Copy linkTweet thisAlerts:
@criterion9Nov 09.2010 — It might be much easier/more efficient to use include rather than try to do it all on the client side.
Copy linkTweet thisAlerts:
@NogDogNov 09.2010 — It might be much easier/more efficient to use include rather than try to do it all on the client side.[/QUOTE]

I'd probably first code it along those lines, loading a new page on submission. Assuming good usage of external style files and such, the browser caching should make the reloads of all the "boiler plate" stuff in the surrounding page quite quickly. Then you could add JavaScript/AJAX functionality if you want on top of that (so that non-JS enabled browsers will still work).
×

Success!

Help @dbk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...