Posted on: 07/21/05 06:40pm
By: kands
Hi,
I have a very simple (or so I think) block that I'm trying to get working. I have a text file called acmon.php with the following content:
echo "68";
note: The page has the opening and closing php tags but they won't display in this posting.
I have put a function into lib-custom.php as follows:
function phpblock_acmon()
{
include 'misc/acmon.php';
}
My block is a php block that simply calls phpblock_acmon.
The problem is that the number, 68, is called and displayed above the geeklog header. So when I view my geeklog site I see some the number 68 on a blank line. It's like the 68 has pushed the webpage down and inserted blank lines at the top.
Any ideas? This seems like is should be very easy and I must be missing something painfully simple...
Thank you,
PHP block is displaying output above Geeklog header
Posted on: 07/21/05 07:44pm
By: jhk
Your block function should
return the output - not send it to the browser using echo. Geeklog "builds" the output using functions et al. When you echo stuff at the wrong time, you bypass all of the nifty code.
return "68"
PHP block is displaying output above Geeklog header
Posted on: 07/21/05 08:17pm
By: kands
That works wonderfully. Thank you.
Here is my code incase anyone else needs this:
function phpblock_acmon() {
$getmon = '/home/acmon/cc';
$displaymon = file_get_contents($getmon);
return $displaymon;
}