Welcome to Geeklog Friday, August 23 2019 @ 03:35 am EDT

Geeklog Forums

PHP script output in the block?


Anonymous

Anonymous
is it possible to do that? i have a script blah.php and i want to show it's outout in the block. thanks

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Yes, that's possible. Create a block of type "PHP block" and make a function that returns the output of your script to Geeklog. I.e. your script should not use echo, print, etc. but collect the output in a string and return that string to Geeklog. It will then show up in the block. bye, Dirk

Anonymous

Anonymous
is it possible to enable php commands in blocks? or is it possible to use php "include" in lib-common.php?

Status: offline

efarmboy

Forum User
Full Member
Registered: 26/02/02
Posts: 147
It is possible to do both - as a phpblock type. Examples of simple phpblocks - which are defined in lib-custom.php: ------- function phpblock_blocktest () { $display = "Hello World"; return $display; } ------- function phpblock_getweather () { global $_CONF; $path = $_CONF['path_html'] . "weather"; include_once($path . "/display_weather.php"Wink; $display = getweather(); return $display; } ------- You will notice how the block output is assigned to a variable and appended as it's build. The output text in $display is then returned and formatted into the block. The second example is where the phpblock calls an external main file which is written to return it's final assembled output text in a variable which is assigned to $display and then finally returned to the GL code for formatting into the block. Blaine

All times are EDT. The time is now 03:35 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