| Writing to predetermined position in file; PHP | |
|---|---|
| Tweet Topic Started: Apr 5 2009, 03:54 PM (274 Views) | |
| GhettoFish | Apr 5 2009, 03:54 PM Post #1 |
|
Awesomeness FTW!
|
Hey. I am trying to set up an installation file for my cixzBB forum but I have some trouble with figuring out how to do this the best way. One way to do this would be to create and write the entire file during the installation. But this seems like a bad way to do it. What I am doing now is to use fopen to create/open file and fwrite to write to file. Now I have this huge array with all the file data and insert the variables in the correct positions in the array. This is definetly one way to do it... If I got it to work that is ![]() What I would like to do is to set up the file like this first.
And then insert the variables into the blank "". So, anyone got any ideas? |
|
I'm not young enough to know everything. - J.M. Barrie http://www.cixz.org/ | |
![]() |
|
| Darksorrow131 | Apr 5 2009, 07:34 PM Post #2 |
|
You can put something random, like $db_psw = "INSERT DB_PSW HERE"; and then read the file, string-replace it with whatever you have, and re-write. Another approach is to simply avoid code generation somehow (not something PHP is good at), and programmatically set the value of $db_psw. Might not work in your case though. |
|
(let loop () (loop)) ((lambda (x) (x x)) (lambda (x) (x x))) (let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k)) ((call/cc call/cc) (call/cc call/cc)) -- Infinite loops are awesome! -- Tell me if you have other awesome infinite loops! | |
![]() |
|
| GhettoFish | Apr 6 2009, 07:27 AM Post #3 |
|
Awesomeness FTW!
|
I didn't get what you meant by "avoid code generation" but the first alternative with string-replace sounds like a good approach. I will look in to that. Thanks a lot mate! |
|
I'm not young enough to know everything. - J.M. Barrie http://www.cixz.org/ | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Web-Based Programming Support · Next Topic » |







10:18 AM Jul 11