So basically i am struggling with the need of optimizing my code for some project of mine.
Currently i have pages like add_company.php, view_company.php, edit_company.php.
What i would like to do is to serve all content from just 1 PHP file company.php.
So to speak company.php?action=view, company.php?action=edit etc. Is the only way to do this with massive if else statements? That would make my company.php 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.
You could make
company.phpQuick and dirty, but should work 🙂 You could place this code in any file, and it will work straight away.
With a bit of modification, you could make this your front controller with
index.php.