1
basil
Custom block doesn't seem to like PHP
  • 2006/12/28 0:42

  • basil

  • Just popping in

  • Posts: 68

  • Since: 2005/2/14


I created a Custom block with content type PHP.

When I inserted this code:

echo "<font size='-4'>".date("D M d Y").':</font>';
echo "<br /><font size='-4'> sunrise time : " .date_sunrise(time(), SUNFUNCS_RET_STRING, -26.54, 148.77, 90, +10) ."</font>";

echo "<br /><font size='-4'> sunset time : " .date_sunset(time(), SUNFUNCS_RET_STRING, -26.54, 148.77, 90, +10) ."</font>";

IT strips everything from the page, and echoes The date only.

Why would that be ?

Basil

2
wizanda
Re: Custom block doesnt seem to like PHP
  • 2006/12/28 1:23

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Your code looks why, your echo ends on the second ", so either use ' or <? the content ?> echoed which will then echo all inbetween it.

3
basil
Re: Custom block doesnt seem to like PHP
  • 2006/12/28 2:55

  • basil

  • Just popping in

  • Posts: 68

  • Since: 2005/2/14


I'm sorry - I don't follow.
Doesn't the echo finish at the ;
I tried using <? ?>, but that didn't work. I found out yesterday you can't use the PHP tags with Content Type PHP Script

This script runs when uploaded to a server as time.php.

I change the code to this:
echo "<font size='-4'>".date('D M d Y').":</font>";
echo "<br /><font size='-4'> sunrise time : " .date_sunrise(time(), SUNFUNCS_RET_STRING, -26.54, 148.77, 90, +10) ."</font>";

echo "<br /><font size='-4'> sunset time : " .date_sunset(time(), SUNFUNCS_RET_STRING, -26.54, 148.77, 90, +10) ."</font>";

Still the result is just the echo of the date, and everything else (from the original page) stripped.

4
wizanda
Re: Custom block doesnt seem to like PHP
  • 2006/12/28 4:29

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Echo shows what is bracketed "so this would be echoed" yet if "you st"ick extra one in" it will only echo the parts bracketed.

5
basil
Re: Custom block doesnt seem to like PHP
  • 2006/12/28 4:45

  • basil

  • Just popping in

  • Posts: 68

  • Since: 2005/2/14


Thanks - but I don't have any extras in there do I?

I tried to use single marks inside the doubles, and then the date_sunrise(time(), SUNFUNCS_RET_STRING, -26.54, 148.77, 90, +10) . concatenates, doesn't it?

I have tested inside normal php tags on a server as time.php, without error too?

As you can see, i'm still none the wiser?

6
iHackCode
Re: Custom block doesnt seem to like PHP

did you include the file with the functions?

.. and why cant you use php in a block?

(And the code in post #3 in this thread looks good. )
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

7
basil
Re: Custom block doesnt seem to like PHP
  • 2006/12/28 5:30

  • basil

  • Just popping in

  • Posts: 68

  • Since: 2005/2/14


Hi
I ended up using an include.

It works now!!

Thanks

Login

Who's Online

152 user(s) are online (71 user(s) are browsing Support Forums)


Members: 0


Guests: 152


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits