Welcome to Geeklog, Anonymous Tuesday, November 26 2024 @ 02:00 am EST

Geeklog Forums

PHP Block Include problem


Status: offline

shane-o

Forum User
Newbie
Registered: 10/14/03
Posts: 4
Hello,

I am trying to create a php block that reads from a text file. I have the following code in lib-custom.php:

function phpblock_spamstats()
{
include 'test.txt';
$retval .= '
htmlasdf';
return $retval;

}

The block reads the file but the output is in the very top left corner of the browser window (above where the geeklog logo.gif displays) not in the block. The html displays properly in the block.

Any assistance is greatly appreciated.

Thank you.
http://www.brokenspoke.ca
Have you broken your spoke today?
 Quote

Peedy

Anonymous
Im also having this problem, is there a way around it, im doing a include to a Pic of the day from a remote site. It puts the pic at the top left.
 Quote

Status: offline

cinoz

Forum User
Chatty
Registered: 09/07/04
Posts: 61
u can create new block and do what u want through the website... log in as admin n go to block.. there create a new block n insert calling function or what soever there.. u can also arrange ur block n where u want to put ur block.. it's easier there.. including putting a html, php function in it..
 Quote

Status: offline

shane-o

Forum User
Newbie
Registered: 10/14/03
Posts: 4
The problem appears when the PHP code is in a new block....
http://www.brokenspoke.ca
Have you broken your spoke today?
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Try echo instead of return

Hey you're in Victoria too!!

We should hook up for a coffee sometime talk geeklog.

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
It also depends on what's in the included file. If it's HTML or plain text, it would be displayed. PHP code would be executed. But that block should not display anything itself, it should return whatever it wants to be displayed and Geeklog will then display it (in the proper place).

bye, Dirk
 Quote

Status: offline

shane-o

Forum User
Newbie
Registered: 10/14/03
Posts: 4
The file is a very simple text file. The file was created on the linux system so there shouldn't be any EOL wierdness.

Any other ideas on where I could look or where I might have messed something up?
http://www.brokenspoke.ca
Have you broken your spoke today?
 Quote

martin

Anonymous
Hello,

I am confronted with the same problem. here is how I solved it until I get an answer on why this is not working. I did
Text Formatted Code

function phpblock_foo() {
    $content = file_get_contents('http://myurl.com/bar.php');
        return $content;
}

 
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by martin: until I get an answer on why this is not working.

See my post above ...
 Quote

All times are EST. The time is now 02:00 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