Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Question with fwrite (https://www.warriorforum.com/programming/587196-question-fwrite.html)

PHPSpaZ 25th April 2012 09:57 AM

Question with fwrite
 
I have a need to generate pages from a back-end GUI. The pages however need to have php in them, this includes various if/else clauses and db connections. I tried to do this with fwrite but even though the functions were in quotes it still made the page that was writing the file throw an error as soon as it hit the first bit of php.

My question is can I write the php to a template file and make fwrite fill in the spaces between when it generates the page or is there another function that will allow me to do this.

phpg 25th April 2012 12:10 PM

Re: Question with fwrite
 
If the error occurs when you are attempting to write '<?php ', try splitting it into something like '<' . '?' . 'php '

fwrite($fp, '<' . '?' . 'php '); instead of fwrite($fp, '<?php ');

Earnie Boyd 25th April 2012 01:02 PM

Re: Question with fwrite
 
Make sure to use a single quote ' character and not a double " character and if you need to output a single quote ' character use a backslash \ character to quote the quote.

PHPSpaZ 25th April 2012 07:01 PM

Re: Question with fwrite
 
Thanks guys, I think I got it now.


All times are GMT -6. The time now is 10:36 PM.