Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 08:43 am EST

Geeklog Forums

Formatting PHP Blocks


Status: offline

MaxPower

Forum User
Newbie
Registered: 05/12/05
Posts: 2
PHP Noob here -

How can I format a PHP Block (specifically a countdown block). Do I make it a normal block and insert HTML code, or is there another way? If so, how?

Thanks!
-Max
Can someone help me
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
have you read this: What are the different block types for?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Depends on the sort of countdown you have in mind. If it should continue ticking after the page has loaded, you'll need JavaScript and you can easily put that in a "normal" block.

Otherwise, write a PHP function that returns whatever you want to display there. There are 2 very simple examples in your lib-custom.php (phpblock_showrights and phpblock_getBent) to get you started.

bye, Dirk
 Quote

Status: offline

MaxPower

Forum User
Newbie
Registered: 05/12/05
Posts: 2
Quote by machinari: have you read this: What are the different block types for?


Yeah - I understand that. I'm using a PHP function that countdowns the number of days left. So can I call the PHP function using the normal block?

-Max
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
from the faq you read: "PHP blocks let you call a PHP function and display that functions' output in the block."

not a normal block or a portal block, but a PHP block. Your PHP function will contain, as Dirk mentioned, whatever you want to display there--including any markup. See the examples that Dirk mentioned.
 Quote

All times are EST. The time is now 08:43 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