|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
A newbie newbie question
Hello
I am trying to build a template driven website (powered by php) but I suck so much so I gave up and came here :p how would I go around doing that? Like, the link will have something like index.php?page=about and depending on the "page=" it would include a different file how would I go around doing that? Thanks oh and btw my php verson is php-4.2.2 |
|
#2
|
|||
|
|||
|
RE: A newbie newbie question
|
|
#3
|
|||
|
|||
|
RE: A newbie newbie question
yes, that would be it, I suck
If the file and the script is at the same directory what would be the path? and does that scrpt work with my php verson? just asking because whole lot of scripts stoped working as soon as I upgraded php-and now people are telling me to use qurrey string or something (not that I want to) thanksssssseeeee |
|
#4
|
|||
|
|||
|
RE: A newbie newbie question
That script will work with your version of PHP. If the file and the script are in the same directory your include statement would be:
More clarification: 1. Replace .ext with the correct extension of the filename. 2. The /path/to/file/ format is assuming *nix box. If you are on a Win32 box then it would be C:\path\to\file\ 3. The script assumes that it is getting the data from a form submission with method set to POST. If you are useing GET then change all occurances of $_POST to $_GET. HTH |
|
#5
|
|||
|
|||
|
RE: A newbie newbie question
Quote:
Use $_GET['page'] |
|
#6
|
|||||
|
|||||
|
RE: A newbie newbie question
Its not working. I must suck sooooo much
this is my index.php php Code:
link to that is http://ubin.nzpages.net/index.php _______________________________________ This is my faq.txt link to that is http://ubin.nzpages.net/faq.txt Try going to the index.php and click on the link. nothing shows up *cries* |
|
#7
|
|||
|
|||
|
RE: A newbie newbie question
When you said "... include a different file", hmmm include is a "keyword" in PHP. So what is it that you want to do?
Do you want to show the contents of faq.txt? |
|
#8
|
|||
|
|||
|
RE: A newbie newbie question
I want to show the contents of faq.txt [depending on what the "page=x" is]
sorry for being an idiot (I cant help it) |
|
#9
|
|||||
|
|||||
|
RE: A newbie newbie question
How were you suppose to know that "include" was a keyword, its my misinterpretation.
Also you see the text in yellow above "// include default file" that is a comment. OK, try this for your index.php file: php Code:
That should do it for now, I guarantee that there will be more. |
|
#10
|
|||
|
|||
|
RE: A newbie newbie question
omgomgomgomgomgomgomg it works! omgomgomgomgomg thank you sooooooooooooooooooooo much!! thank you!!!!!!
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > A newbie newbie question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|