i have a few templates that print recursive summaries
im using the slim renderer that comes with the slim framework - \Slim\Views\PhpRenderer
im trying to do a bunch of recursive summaries in a set, i fetch the template output and dump it into a file and then turn the file into a pdf
all the pages with recursive summaries work fine on the individual pages and the export to PDF also works fine with these pages
but when i try to do the batch set and do the same template with its recursive method more than once i have trouble
the first result of fetch makes it into the html file and the PDF is generated fine but it errors on the second one saying:
“Fatal error: Cannot redeclare printSummaryTree()”
which is just a basic recursive function in the template, i have many templates with the same function name it doesnt cause any issues
‘function printSummaryTree($tree, $depth)’
its like the method defined in the previous template fetch is still in scope or something?
in the class that calls fetch, i tried to get a complete new renderer right before calling fetch, no affect
…$this->view = new \Slim\Views\PhpRenderer(‘path/to/templates’)
$output = $this->view->fetch(’…
if i follow the method call into the renderer i can see where it includes the template
if i change it from:
"
protected function protectedIncludeScope ($template, array $data) {
extract($data);
include $template;
}
"
to:
"
protected function protectedIncludeScope ($template, array $data) {
extract($data);
include_once $template;
}
"
the script will run to completion but only the first fetch is successful, all the html is blank in the other files
anyone know where i am going wrong? how do i clear the scope/cache whatever it is?