Serve multiple pages from 1 PHP file?

1227canada

New Member
So basically i am struggling with the need of optimizing my code for some project of mine.Currently i have pages like \[code\]add_company.php\[/code\], \[code\]view_company.php\[/code\], \[code\]edit_company.php\[/code\].What i would like to do is to serve all content from just 1 PHP file \[code\]company.php\[/code\].So to speak \[code\]company.php?action=view\[/code\], \[code\]company.php?action=edit\[/code\] etc. Is the only way to do this with massive if else statements? That would make my \[code\]company.php\[/code\] like mega huge.Or maybe even better how could I serve all my pages just using index.php ?So what would be the best way to accomplish this? I am not php guru and i don't have much experience with MVC or any other pattern.Thanks.
 
Back
Top