Discussion on program structure

This is a discussion on Discussion on program structure within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi! Once again I am building a simple app that shows data that users can add and manipulate from a ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-26-2005
Jam Pa
 
Posts: n/a
Default Discussion on program structure

Hi!

Once again I am building a simple app that shows data that users can add
and manipulate from a form on a web page.

I would like to discuss about simple simple solutions to these common
problems. Please join in, and add your own comments, and questions.

My question is, whats a clever way of handling the part where user adds
data?

I have simple solution like this: 'commands' are sent through GET (in url)
to the server, where index.php or similar file includes other files
accordingly. Now this doesn't work well with OO where I am headed.

And I need lots of files, basically one or more per 'command' or 'action'.
Say for instance I have 'add entry' action in a blog. First the app must
show the user a form from which user can post their entry, then the app
must handle that data (another php file, ie. clean data up and add it to
the db) and finally display thanks on the client (third file, xhtml). Whew!
Reply With Quote
  #2 (permalink)  
Old 05-26-2005
Kimmo Laine
 
Posts: n/a
Default Re: Discussion on program structure

"Jam Pa" <anonanon@non-anon.org> wrote in message
news:Xns96627C2149454anonanonnonanonorgjp@213.243. 153.2...
> Hi!
>
> Once again I am building a simple app that shows data that users can add
> and manipulate from a form on a web page.
>
> I would like to discuss about simple simple solutions to these common
> problems. Please join in, and add your own comments, and questions.
>
> My question is, whats a clever way of handling the part where user adds
> data?
>
> I have simple solution like this: 'commands' are sent through GET (in url)
> to the server, where index.php or similar file includes other files
> accordingly. Now this doesn't work well with OO where I am headed.
>
> And I need lots of files, basically one or more per 'command' or 'action'.
> Say for instance I have 'add entry' action in a blog. First the app must
> show the user a form from which user can post their entry, then the app
> must handle that data (another php file, ie. clean data up and add it to
> the db) and finally display thanks on the client (third file, xhtml).
> Whew!


I put lots and lots of stuff in a single page. For instance I may have three
different forms and form handlers in a single file. I keep them separate
with something like

if($_REQUEST['list']) {
// something
} else if($_REQUEST['save']) {
// something else
} else if($_REQUEST['delete']) {
// something else
}

Keeps the number of pages small, and since they are all related to same
area, all require the same settings, sessions and libraries, I just modify
the action segments in the middle and I only need to write once the section
where I include all libs and settings and shit.

--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com


Reply With Quote
  #3 (permalink)  
Old 05-26-2005
Colin McKinnon
 
Posts: n/a
Default Re: Discussion on program structure

Jam Pa wrote:

> Hi!
>
> Once again I am building a simple app that shows data that users can add
> and manipulate from a form on a web page.
>
> I would like to discuss about simple simple solutions to these common
> problems. Please join in, and add your own comments, and questions.
>
> My question is, whats a clever way of handling the part where user adds
> data?
>
> I have simple solution like this: 'commands' are sent through GET (in url)
> to the server, where index.php or similar file includes other files
> accordingly. Now this doesn't work well with OO where I am headed.
>


Why not? What you've described is a front-controller pattern. If you're a
patterns kind of person, you use the FC to multiplex the M[V]C objects.

C.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:12 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0