Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 07:59 am EST
Geeklog Forums
World times
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
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 ?
But I can't put php functions in blocks or it seems I can't any idea's ?
5
3
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: Dirk
Hmm? PHP blocks, baby!
bye, Dirk
Quote by: trampoline
But 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...
6
4
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: trampoline
Just 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
8
6
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Thanks, I guess all I want is
New York 17.06
London 12.06
Delhi 07.06
I will look at it all again...
New York 17.06
London 12.06
Delhi 07.06
I will look at it all again...
5
4
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
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...
<?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...
global $_CONF;
include_once($_CONF['path_html'] . "/time/time.php");
return display_time();
}
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();
}
6
4
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
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...
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 ????
This iss called by the code posted here in libcustom.php which in turn is called by the php block...
Text Formatted Code
<?phpfunction 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 ????
4
6
Quote
Why make the call to another file which houses the code, just write it into your function in lib-custom.php ?
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...
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...
5
4
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Oh Thank you so much, I've been struggling,so much with this one
5
7
Quote
All times are EST. The time is now 07:59 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