1
cavergary
Add New Block - Content type php script HELP
  • 2006/10/13 22:43

  • cavergary

  • Just popping in

  • Posts: 16

  • Since: 2005/3/30


I've been trying to add a new block with the following php script. I drop this code in the content block and set the content type to php script. All I get is the block name in the preview. The block does not show on the site at all! Any ideas?
le="color: #000000"><?php <? //----------------------------------------------------- //------COUNT DOWN TIMER------------------------------- //----------------------------------------------------- // enter start date below like this: "January 2, 2001" $end = "May 6, 2007"; // enter string of what this start date is. $text = "until the conference!"; $textOnTheDay = "G'07 begins today!!!"; $textAfterwards = "Check out the procedings."; //-------------------------- $now = strtotime ("now"); $then = strtotime ("$end"); $difference = $then - $now; $num = $difference/86400; $days = intval($num); $num2 = ($num - $days)*24; $hours = intval($num2); $num3 = ($num2 - $hours)*60; $mins = intval($num3); $num4 = ($num3 - $mins)*60; $secs = intval($num4); if ($days>0 || $hours>0 || $minutes>0 || $seconds>0) { ?> <p> <? echo $days ?> days, <? echo $hours ?> hours, <? echo $mins ?> minutes, <? echo $secs ?> seconds <? echo $text ?> </p> <? } else if (($days==0) && ($hours<=0 || $minutes<=0 || $seconds<=0)) { ?> <p><? echo $textOnTheDay ?><p> <? } else { ?> <p> <? echo $textAfterwards ?></p> <? } ?>

2
tedsmith
Re: Add New Block - Content type php script HELP
  • 2006/10/13 22:53

  • tedsmith

  • Home away from home

  • Posts: 1151

  • Since: 2004/6/2 1


Not entirely sure, but if you select PHP script, I think it has to be pure PHP without HTML in it. You have, in effect, seperate PHP code intertwined with HTML. So I expect that the PHP is being parsed but not displayed because it's ignoring the HTML.

Try 'Autoformat' instead of 'PHP Script' and see if that helps?

On my homepage, I have a PHP script as follows that has no PHP declarations (<?) or HTML tags, but it is set as a PHP script and so is treated as such by XOOPS without the declarations, and it works fine :

le="color: #000000"><?php $db =& Database::getInstance(); list( $countA ) = $db->fetchRow( $db->query( "SELECT COUNT(*) FROM ".$db->prefix("myalbum_photos")." WHERE status>0" ) ) ; echo 'The total number of lost dog reports on this site is currently ' . $countA;

3
[suspendTempri[suspended]
Re: Add New Block - Content type php script HELP

I modified your code but I didn't try if it works. Try to put this code into the block:

le="color: #000000"><?php $end = "May 6, 2007"; $text = "until the conference!"; $textOnTheDay = "G'07 begins today!!!"; $textAfterwards = "Check out the procedings."; $now = strtotime ("now"); $then = strtotime ("$end"); $difference = $then - $now; $num = $difference/86400; $days = intval($num); $num2 = ($num - $days)*24; $hours = intval($num2); $num3 = ($num2 - $hours)*60; $mins = intval($num3); $num4 = ($num3 - $mins)*60; $secs = intval($num4); if ($days>0 || $hours>0 || $minutes>0 || $seconds>0) { print '<p>'; print "$days days, <br />"; print "$hours hours, <br />"; print "$mins minutes, <br />"; print "$secs seconds, <br />"; print "$text"; print '</p>'; } else if (($days==0) && ($hours<=0 || $minutes<=0 || $seconds<=0)) { print "<p>$textOnTheDay<p>"; } else { print "<p>$textAfterwards</p>"; }

4
cavergary
Re: Add New Block - Content type php script HELP
  • 2006/10/16 19:09

  • cavergary

  • Just popping in

  • Posts: 16

  • Since: 2005/3/30


Works Great! Thanks a million!

Who's Online

212 user(s) are online (158 user(s) are browsing Support Forums)


Members: 0


Guests: 212


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits