1
audia4
including php file in block
  • 2003/10/24 8:20

  • audia4

  • Just popping in

  • Posts: 6

  • Since: 2003/8/4 9


I get this error when i try to include a php file in a block.

************************************************
Warning: Unknown(/modules/chat/blocks/block.php): failed to open stream: No such file or directory in d:\home\sharetrader\class\xoopsblock.php(146) : eval()'d code on line 1

Warning: (null)(): Failed opening '/modules/chat/blocks/block.php' for inclusion (include_path='.;c:\php4\pear') in d:\home\sharetrader\class\xoopsblock.php(146) : eval()'d code on line 1
************************************************


if i run the php file on its own it works, but not as included?

2
onokazu
Re: including php file in block
  • 2003/10/24 14:14

  • onokazu

  • XOOPS Founder

  • Posts: 617

  • Since: 2001/12/13


What did you actually write for the block? I think the path is not correct. Try with XOOPS_ROOT_PATH.'/modules/chat/blocks/block.php

3
Globalforest
Re: including php file in block

Hi

I am trying to include a php file in a custom block.

In the (PHP) block I have:
include XOOPS_ROOT_PATH."test.php";

test.php is simply:
<?php
echo "Test successful";
?>

But there is nothing - not even an error. Any help would be much appreciated

Cheers

4
ghia
Re: including php file in block
  • 2010/2/5 11:04

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


And if you hard code the XOOPS path in the block?

5
Globalforest
Re: including php file in block

Blank page - i.e. absolutely nothing (no headers nothing)

Tried using
include("{X_SITEURL}test.php");

At least I get the headers but the Block is empty (not even the title) - sitll this is progress

6
ghia
Re: including php file in block
  • 2010/2/6 12:53

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The XOOPS path, not the URL!

7
Globalforest
Re: including php file in block

Well I don't know why but I managed by a matter of hacking away and trying all sorts to get it to work and ended up using:

include("../../test2.php");

I have spent a day but it was worth it now

8
equinox
Re: including php file in block
  • 2010/2/7 1:14

  • equinox

  • Just popping in

  • Posts: 13

  • Since: 2010/1/17


hi at all,

yes, this is functionally, becauce your include in a custom_block begins from the XOOPS_ROOT_PATH automatically.
I think, if you edit (as example your test2.php file) and include there as first the mainfile.php:
<?php
include("../../mainfile.php"); //change the ../ to your rootpath
?>
so it still work too. (Maybe the header.php and the footer.php is also required to include too.)

Greez Thom

9
ghia
Re: including php file in block
  • 2010/2/7 9:41

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
include("../../test2.php");
Watch out, if you have not a default module, this could fail on your home page.

Login

Who's Online

139 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 139


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits