okay first [man]file_get_contents()[/man].
Yeah I know that would be the best way of doing it but it's only valid as of php 4.3.+ and I was initially using 4.1.1. However, since I upgraded my server to 5.1 I believe. I'm not there now so I can't check but it's 5 something.
Anyway, the server this is going to be running on is a godaddy server that runs 4.3.1 I believe; so yes I could change over to file_get_contents() now. I probably will do that. Thanks for reminding me.
Next, eval.
So I'm taking it from everything you said there that eval will be needed? As far as writing it like a php file with <?php and ?>. The file you are looking at... the
TPL-BIT:LOCATION_CREATE from inlets is not exactly my best example.
In most cases their is a lot of php variables in the code. As you can see this is just a form that you input data into, there are other pages where the data is edited so I have to pull the information my mysql and display in it forms. Which usually means the file includes variables like $record->name in the input value.
I really don't want to go through and write <?php and ?> everytime I insert a variable.
as for this
eval("\$bit = <<<SOMETHINGTHATNEVERAPPEARSINABIT
$bit
SOMETHINGTHATNEVERAPPEARSINABIT;");
I have no idea what that means. I really don't understand eval. I mean I have a general idea of what it does but it's very general.
$bit = $this->bit('whatever');
$bit = str_replace('\', '', $bit); // escape any backslashes already present
$bit = str_replace('"', '\"', $bit); // dalecosp's suggestion
eval("$bit = "$bit\";"); //which is what herve said
So this pretty much just avoids the additions of slashes before \ and ' during my script and just adds them before ". That could be a smarter solution. I'll look into that when I start working with the script.
Does anybody have a good tutorial for template creation so I can see a more proper way to go about developing a template based script?
Thanks Weedpacket, good information, it helps a lot.