2

I am restructuring a custom built framework and would like to implement something similar to Cakephp's $content_for_layout variable. Instead of creating layouts separate for each user type.

I would like to execute the content inside the included file and then store it into one variable and just echo that in the layout file.

Please suggest how this can be achieved?

Thanks

mark
  • 21,691
  • 3
  • 49
  • 71
Mir Adnan
  • 844
  • 11
  • 24

2 Answers2

0

with:

echo eval($content);

can you execute the content(php in this case).

I hope help you.

0

Like ... this?

file1.php:

<?php

   include 'file2.php';

   echo $result;

file2.php:

<?php

#do stuff

$result = #result of your stuff

Or do you want to do something more complicated than that? Your question is not very clear.

user428517
  • 4,132
  • 1
  • 22
  • 39
  • I would like to render the view as the last thing when everything else has completed. So, I would like to have the out stored into a variable to I can echo it later in the end in the layout file. – Mir Adnan Aug 15 '13 at 23:47