Should I use a one php program or multiple

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have taken over a php web site. Once you login you are given six menu
choices. Each option is or can be independant of the others. They each
modify the same database but in different ways.

On clicking the menu buttons the program calls php functions to do the
action. Thus the user stays inside a large program.

I was expecting the menu to provide links rather than function calls.
1) Is there a reason to stay inside a large program through function
calls rather than linking to separate pages?

2) Am I correct that providing a <a href=... link would isolate the
functionality and call a new program?

The current program is spagettii code and somewhat buggy. There are
side effects that depend on what function was called before. I am
hoping that passing the hidden input parameters is all the connectivity
I need.

Re: Should I use a one php program or multiple wrote:

Quoted text here. Click to load it


Well, maybe the original programmer uses some framework?
Or (s)he just liked that approach.
Or maybe in that particular situation it made some sense?
Hard to say without diving into the project.

I can only say my personal taste is always to create seperate pages, simply  
because that keeps one script focussed on the task at hand, and keeps the  
script small, thus less errorphrone.
I often do use a common functions file, which is included in all the  
seperate scripts.

Quoted text here. Click to load it

Well, it just calls whatever you put into the href.
This can be the same script all the time with different values in the  
GET/URL, like:
<a href="bigscript.php?action=modifyTBLUSER">edit users</a>
<a href="bigscript.php?action=modifyTBLHISTORY">edit history</a>
<a href="bigscript.php?action=modifyTBLARTICLES">edit articles</a>

In that example all is handled by 'one program' (bigscript.php).

By the way: I think it is more common to just refer to scripts instead of  
For example: A program is the PHP interpreter (or Firefox browser, or Gimp,  
etc.), and bigscript.php is a script (just a file) that gets read and  
interpreted/executed by the PHP-executable (program).

Quoted text here. Click to load it

Well, if the code is a mess, you better start eating through it and make it  
more structured. That way you will probably be more able to find the bugs.

Just my 2 cent.

Erwin Moller

Site Timeline