Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 04:22 am EST
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
5
7
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/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
6
7
Quote
Anonymous
Anonymous
is it possible to enable php commands in blocks? or is it possible to use php "include" in lib-common.php?
6
5
Quote
Status: offline
efarmboy
Forum User
Moderator
Registered: 02/26/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"
$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
6
7
Quote
All times are EST. The time is now 04:22 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