thanks for your reply,
i was under the impression that i was separating my presentation from business logic already, but i'm beginning to think i really haven't done that. what i do is have a page that does all the work and creates a collection (array) of variables, then simply passes those to a template with placeholders for those variables.
maybe it's only a matter of creating a new condition of if (ajax){output to ajax template} else {output to html template }. i can't tell...i'm just very confused as to how i should even start this or if i'm already prepared for what i'm needing and don't even know it.
maybe it'll help to have some code (mods if this is becoming a topic for the 'PHP' forum, feel free to move)
PHP Code:
switch ($action){
case 'complete':
// echo "settings saved" message
break;
case 'submit':
// parse variables
if (!errors){
// save into database
// forward to $action=complete
} else {
// echo forms (and display errors)
}
break;
case 'default':
default:
// echo forms
break;
}
the preceding is the logic i'm using currently. i could just add extra if(ajax) statement...but it seems like that will only prepare me for this one instance of ajax (and it will double the number of template pages i have, one for HTML and one for AJAX). how will i know if the current code i'm writing is ready for all future upgrades to different output techniques?
i've been searching for the past hour since i first posted, and i'm beginning to think design patterns are the way to go. I'm checking out MVC as you suggested now...maybe that can get me where I'm trying to go. as it is now, design patterns are pretty much nonexistent in my app.
Bookmarks