php include |
![]() ![]() |
php include |
![]()
Post
#1
|
|
![]() Death is a promise given to us at birth ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 4,757 Joined: Mar 2004 Member No: 7,459 ![]() |
does anyone know the script to php include? I don't mean the regular kind.
QUOTE something like that?^ |
|
|
![]()
Post
#2
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 ![]() |
It's called a Query string. The code is pretty simple if you use the GET function. Try this code.
CODE <?php if ( isset( $_GET['VARIABLE'] ) ){ $page = $_GET['VARIABLE']; } if ( empty( $VARIABLE ) || $VARIABLE == '' || $VARIABLE == '0' ){ echo "This is the default content. (i.e. - Home Page content)"; } else if ( $VARIABLE == 'VALUE1' ){ echo "This is the content of this value or it could also be the default content. (i.e. - Page 1 content)"; } else if ( $VARIABLE == 'VALUE2' ){ echo "This is the content of this value. (i.e. - Page 2 content)"; } else { echo "Error page here."; } ?> 1.) Replace VARIABLE with the name of the varible you want to use, i.e. - "page". 2.) Replace VALUE1 with the value of your choice so that it'll show up as http://www.example.com/path/to/file.php?VARIABLE=VALUE#1. 3.) Repeat step 2 for VALUE2. 4.) Now replace the fillers for each value. 5.) (Optional:) If you want to add more than 2 values and what not, then just repeat this part of the code and edit it accordingly. CODE else if ( $VARIABLE == 'VALUE' ){ echo "This is the content of this value."; } That's pretty much it. I'm not sure though how to add different variables but you could doing the same technique in step 5 except you replace both the variable and the value. If you want to see it in action, go here. Good Luck. ![]() |
|
|
![]()
Post
#3
|
|
![]() Death is a promise given to us at birth ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 4,757 Joined: Mar 2004 Member No: 7,459 ![]() |
i'll give it a tried.
|
|
|
![]()
Post
#4
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 ![]() |
Oh, and btw, the code won't work unless you have a .php extenstion on your page.
![]() |
|
|
![]()
Post
#5
|
|
![]() Death is a promise given to us at birth ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 4,757 Joined: Mar 2004 Member No: 7,459 ![]() |
well i get that.
Do you know any other query string like this, but different? |
|
|
![]()
Post
#6
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 ![]() |
I'm not sure what you mean. Are talking about a different code, an easier method, how to create multiple varaibles?
|
|
|
![]()
Post
#7
|
|
![]() Death is a promise given to us at birth ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 4,757 Joined: Mar 2004 Member No: 7,459 ![]() |
yeah. there is another code that i used to used. But i can't find it anymore. I think it has php include in the code for multiple pages.
|
|
|
![]()
Post
#8
|
|
Member ![]() ![]() Group: Member Posts: 10 Joined: May 2009 Member No: 729,459 ![]() |
Thanks Mikeplyts,
I was looking for this information for quite some time. I m new here and impressed to find such a nice information so soon. Thank you so much for great share. |
|
|
![]() ![]() |