| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#21 (permalink) |
|
Grumpy old man
Join Date: Oct 2007
Location: North Japan
Posts: 1,696
|
Another thought that just occurred. If you want to use a text file, why not use the method that most php config files use. So instead of your textfile containing this: Code:
instead, make it like this: Code:
Then all you need to do is add a line to your page saying include "word.txt"; and the variable will automatically be set without having to check anything. Plus you've got the basis of a config file which you could easily use to store more settings if you require them in the future. |
|
|
|
|
|
#23 (permalink) |
|
with a hint of lemon
Join Date: Aug 2006
Location: Sheffield
Posts: 496
|
On my cms, i have a form with two options: Code:
which then the option value is posted to this file Code:
However, if i change the value of the options to make it so that the script adds: Code:
instead of just Code:
its ouputs with these \\ that then causes it not to work Online portfolio: mgpwr.co.uk
|
|
|
|
#25 (permalink) |
|
competitionmaster 2.0
Join Date: Oct 2006
Location: USA
Posts: 1,420
|
Try $word = file_get_contents('fullServerPath/word.txt'); if($word=='yes') { echo 'available'; } else { echo 'not available.'; //show not for hire stuff } Replace fullServerPath with the whole path to the word.txt file. (I actually tested this one, and it does work) |
|
|
|
#28 (permalink) |
|
Grumpy old man
Join Date: Oct 2007
Location: North Japan
Posts: 1,696
|
Yeah, you got there before me. That was what I was coming around to. I was a bit baffled because previously he'd said he was using the CMS to create the file, as a reason not to follow the way I'd suggested (which I still thing is a lot neater and easier than reading and writing strings to files). |
|
![]() |