Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 09:02 am EDT

Geeklog Forums

PHP block is displaying output above Geeklog header


Status: offline

kands

Forum User
Newbie
Registered: 04/01/03
Posts: 5
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,
 Quote

Status: offline

jhk

Forum User
Chatty
Registered: 07/13/02
Posts: 57
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.
Text Formatted Code
return "68"
 
 Quote

Status: offline

kands

Forum User
Newbie
Registered: 04/01/03
Posts: 5

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;
}
 Quote

All times are EDT. The time is now 09:02 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content