1
miha23
Add a new block - php script
  • 2004/5/24 10:56

  • miha23

  • Just popping in

  • Posts: 19

  • Since: 2003/2/15


I am trying to display a coundown to a specific date in a blok. Therefor I created a new block and for the content type I selected "PHP Script".
I entered my script but the bloc does not display anything.
Is there anything special I need to know?

The script is very simple. One include statement, one function call and one echo function.

Thank you for your help.

2
Herko
Re: Add a new block - php script
  • 2004/5/24 11:08

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Make sure the script doesn't have the starting <?php and ending ?>, as XOOPS adds that automatically. Without those, the script and block should work.

Herko

3
intel352
Re: Add a new block - php script
  • 2004/5/24 13:02

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


erm.. all blocks that i've created and seen have the starting/ending php tags. you guys are referring to a block for a module, correct?

if so, he is probably missing a template file for the block, and he also needs to reference the block in xoops_version.php for the module.

4
Herko
Re: Add a new block - php script
  • 2004/5/24 13:07

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


I thought he meant a custom block, set as type PHP.

herko

5
intel352
Re: Add a new block - php script
  • 2004/5/24 13:09

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


ahh, i'll bet you're right, lol, i'm used to the code side, not adding via admin, hehe

sorry herko

6
miha23
Re: Add a new block - php script
  • 2004/5/24 15:09

  • miha23

  • Just popping in

  • Posts: 19

  • Since: 2003/2/15


Thanks for the quick reply!

It helps if I enter the code without <?php ?>. But now I have a blankpage with only the echo statement showing.
I think it is a problem with my include statement. While
include("../countdown/coundown.php"); will work in modules (the countdown dir is in /modules/ dir) I am not sure if it will work on my main page as it is not in the modules directory bacause I have no module for a start page(only blocks).

Do you know how I should form the include?
If I include the fullpath I get an error with the seek stream reported.

Thank you!

7
intel352
Re: Add a new block - php script
  • 2004/5/24 15:19

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


could you clarify how you're creating this block? are you creating it through the Block Admin?

if so, i'm not sure an include statement will work there, but try this:
include(XOOPS_ROOT_PATH."modules/countdown/coundown.php");

8
miha23
Re: Add a new block - php script
  • 2004/5/24 15:24

  • miha23

  • Just popping in

  • Posts: 19

  • Since: 2003/2/15


Yes through admin->System->Blocks->New Block.
Looks like includes do not work?! Although if I click on preview the block displays correctly. But if I set it to visible my main page goes blank.

I also tried to paste the whole script into the block and it works correctly.

9
intel352
Re: Add a new block - php script
  • 2004/5/24 15:35

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


i just noticed, in the include that you posted, you have 'coundown.php' << is it actually spelled with the 't' missing?

anyways, if it works properly in the block, why not just leave it there?

10
miha23
Re: Add a new block - php script
  • 2004/5/24 15:39

  • miha23

  • Just popping in

  • Posts: 19

  • Since: 2003/2/15


hehe, thanks but I just misstyped it here.
I checked it like a hundret times in the block.

For now I am leaving it there.
But I still do not understand why include wouldn't work?

Login

Who's Online

163 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 163


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