Hi there guys,

I've run into a stumbling block on one of my projects. I've integrated a chat system into a PHP-Nuke install. To view the who's chatting block, they have you include a php file via an iframe. Problem is that a lot of people are having problems viewing the iframe.

The way the blocks work is that the content is defined in the block:

$content = "block content"

My question: Is there a way to have $content = included/file.php ?

I tried

$content = "/included/file.php";
$content = /included/file.php;
$content("/included/file.php");

But as I'm sure you know, it didn't work 🙂

Could someone tell me how I might set $content to equal a file that needs to be included?

thanks,
json

    Why not simply include the file when it is needed?

      Only because the CMS keeps printing $content and the value changes inside each block code. If I can get this included file to equal $content, then I should be all set.

      thanks,
      json

        if your include file is of the style:

        <?php
        $content = "
        blablablabla
        and more
        blablablabla
        with a ".$var." makes a great include
        ";
        ?>
        

        and you include it at the moment you need it, the variables in the include will be set to the current, and you can use $content as a normal string var.

          Not sure I understand the question, but if the objective is to capture the output of an include file into a variable:

          ob_start();
          include '/path/to/include.php';
          $content = ob_get_clean();
          
            Write a Reply...