Hi.
I wonder if its any good to state a code on Get statements and OOP?
Exampel:
I got my index.php
in it i got like if that do that statements which indicates if the get "action" = " ... " or " ... "
Then collect from OOP... I am building an internet game which is based on alot of scripting and pages.
Would this do something bad for my script or anything else?
//Thanks in advance
//Thomas
OOP and Get statements
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: OOP and Get statements
Some example code would make your question clearer. It sounds like you are using if() statements to check the values in $_GET?? That is one way to handle it. You should look at the Page Controller and Front Controller patterns.
(#10850)
Re: OOP and Get statements
Ok, so exampels:
If $_GET.... is action page then
include oop
end if...
Now im asking if its ok to go forth with this all the way through a projekt so its basicly only one page and alot of OOP pages..
Im building a game BTW just so u know the size of the projekt "ITS HUGE"
If $_GET.... is action page then
include oop
end if...
Now im asking if its ok to go forth with this all the way through a projekt so its basicly only one page and alot of OOP pages..
Im building a game BTW just so u know the size of the projekt "ITS HUGE"
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: OOP and Get statements
What you are describing is a Front Controller. Yes it is a good idea.
Perhaps you should consider using a framework like Zend or CodeIgniter.
Perhaps you should consider using a framework like Zend or CodeIgniter.
(#10850)
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: OOP and Get statements
Definitely look at some frameworks. If your project is going to be quite large then using a documented framework with some good conventions will make things easier in the long run.
But at the very least, do some reading up on the front-controller design pattern as Christopher mentions. You will find many examples offering approaches with differing levels of complexity.
But at the very least, do some reading up on the front-controller design pattern as Christopher mentions. You will find many examples offering approaches with differing levels of complexity.