Welcome to Geeklog Sunday, September 15 2019 @ 06:16 pm EDT

Geeklog Forums

PHP block is displaying output above Geeklog header


Status: offline

kands

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

Status: offline

jhk

Forum User
Chatty
Registered: 13/07/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.
PHP Formatted Code
return "68"
 

Status: offline

kands

Forum User
Newbie
Registered: 01/04/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;
}

All times are EDT. The time is now 06:16 pm.

  • 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