Posted on: 04/23/07 04:19pm
By: trampoline
I would like to display very simply in a block, times around the world ??
But I can't put php functions in blocks or it seems I can't any idea's ?
Re: World times
Posted on: 04/23/07 04:24pm
By: Dirk
Quote by: trampolineBut I can't put php functions in blocks
Hmm?
PHP blocks, baby!
bye, Dirk
Re: World times
Posted on: 04/23/07 04:30pm
By: trampoline
Quote by: DirkQuote by: trampolineBut I can't put php functions in blocks
Hmm?
PHP blocks, baby!
bye, Dirk
Yes, but I am so incredibly thick I could not make it work, I have bought a very fat book on php "PHP 5" by Julie Meloni and am wading through it in my spare time...
Just though I'd ask as my first attempt got nowhere adding functions to custom lib and calling them...
Re: World times
Posted on: 04/23/07 04:59pm
By: Dirk
Quote by: trampolineJust though I'd ask as my first attempt got nowhere adding functions to custom lib and calling them...
You would have to be more specific if you expect any help ...
Keep the naming convention in mind. There's also a function phpblock_showrights in your lib-custom.php that you could use to start playing with.
bye, Dirk
Re: World times
Posted on: 04/23/07 05:03pm
By: trampoline
Thanks, I guess all I want is
New York 17.06
London 12.06
Delhi 07.06
I will look at it all again...
Re: World times
Posted on: 04/24/07 04:11am
By: trampoline
so I have this code.... I know it's not quite right
I have created a block phpblock_worldtimes
a function in lib-custom
and it does call the function cos I've had a few lines printed (incorrectly) I have this as the code for the info to be printed...
Text Formatted Code
<?php
function display_time() {
global $_CONF;
$time_new = time() +18000;
$time_london = time() ;
$time_dharam = time() -19800;
$newname ="New York";
$lonname ="London";
$daram ="Dharamsala";
<? echo "$newname"; ?>
<? echo "$time_new"; ?>
<? echo "$lonname"; ?>
<? echo "$time_london"; ?>
<? echo "$daram"; ?>
<? echo "$time_dharam"; ?>
" ;
?>
and this as the lib custom code...
Text Formatted Code
function phpblock_worldtime() {
global $_CONF;
include_once($_CONF['path_html'] . "/time/time.php");
return display_time();
}
Re: World times
Posted on: 04/24/07 02:33pm
By: trampoline
OK by stipping out all functions and doing a simple
This iss called by the code posted here in libcustom.php which in turn is called by the php block...
Text Formatted Code
<?php
function display_time() {echo "this is line" .__LINE__ ;}
?>
I get it working but the text appears in the tiop left hand corner of the Frame how do I get this to display in it's block ????
Re: World times
Posted on: 04/24/07 02:45pm
By: Dirk
You may want to read the FAQ article above again, specifically the bit about not outputting things directly but returning them from the function ...
bye, Dirk
Re: World times
Posted on: 04/24/07 02:54pm
By: uKrease
Why make the call to another file which houses the code, just write it into your function in lib-custom.php ?
Text Formatted Code
function phpblock_showtimes() {
$result = '';
$time_new = time() +18000;
$time_london = time() ;
$time_dharam = time() -19800;
$newname ='New York';
$lonname ='London';
$daram ='Dharamsala';
$result = $newname . ' - ' . $time_new . '<br>';
$result .= $lonname . ' - ' . $time_london . ' <br>';
$result .= $daram . ' - ' . $time_dharam . '<br>';
return $result;
}
Then, create a block with the call to phpblock_showtimes...
I tested that on my site and it worked fine, you`ll just need to play around with the PHP time() function to get the output of the time correctly formatted...
Hope that helps...
Re: World times
Posted on: 04/24/07 02:56pm
By: trampoline
Oh Thank you so much, I've been struggling,so much with this one