Page 1 of 1

Create dynamic pages[NOT SOLVED]

Posted: Thu Oct 31, 2013 11:29 am
by bagi
Hi all, I need to create php page (if u have best way, write) which will show another content depending on a request. For example, site.com/account and site.com/account?settings must show another pages (with significant differences!). What is a best way to solve this problem? I need to create ramification with setting request and with no this?

Re: Create dynamic pages

Posted: Thu Oct 31, 2013 12:22 pm
by Celauran
Sounds like you want a front controller to capture all incoming requests and then route them as needed.

Re: Create dynamic pages

Posted: Thu Oct 31, 2013 2:10 pm
by bagi
Yes, but I don't understand it on my example.
If i have a request I need to create a ramification witch will handle that?

For example

Code: Select all

if($command == "showProfile"){/*showing a profile*/}
else if($command == "saveSettings")//now we saving inputted settings
and ect. I right understood this approach?

Re: Create dynamic pages

Posted: Thu Oct 31, 2013 2:41 pm
by bagi
And is a good way to store all functions in one php file and include that in each file?

Re: Create dynamic pages[NOT SOLVED]

Posted: Mon Nov 04, 2013 9:48 am
by rhecker

Code: Select all

switch ($_GET['command']){
case 'showProfile':
include('profile.php');
break;
case 'saveSettings':
include('savesettings.php');
break;
}
I used include files in the example above, but it could also be a query, a variable, or whatever, and any combination thereof.

. . .and sometimes it makes sense to store all functions in one php file, unless it will load a lot of unneeded code in some pages.