2

Does it possible to execute php file and store its output into some variable?

For example i have one global template, then i need to process subtemplates, and afterall i need to insert that subtemplate output into global template block.

How can i do it ?

1 Answer 1

6

You can use the output control functions, buffer the output with ob_start and retrieve it with ob_get_contents:

ob_start();
func();
$output = ob_get_contents();
ob_end_clean();
Sign up to request clarification or add additional context in comments.

1 Comment

thank, this is all i need. i just forgot about that buffers feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.