To answer your original question (even though getting the urls to work is probably better), do the same thing you would to generate an html page. Have a template with something like:
PHP Code:
// some_demo.php.tremplate
// Here is a php function that will end up in my generated php file
function some_demo()
{
$a = "<?php echo $aPassed; ?>";
echo $a;
}
And then use a basic template processing approach:
PHP Code:
// Here I am with my generator
// Want to pass this to the generated file
$aPassed = 'some demo info';
// Pull in the template
ob_start();
include 'demo.php.template';
$body = ob_end_clean();
// And store it with a php tag
file_put_contents('generated.php',"<?\n" . $body);
This is also handy for generating caches file of one sort or another.
Bookmarks