Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 - 2 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: Add New Block - Content type php script HELP
by cavergary on 2006/10/16 19:09:21

Works Great! Thanks a million!
Re: Add New Block - Content type php script HELP
by [suspendTempri[suspended] on 2006/10/14 7:37:50

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>"; }
Re: Add New Block - Content type php script HELP
by tedsmith on 2006/10/13 22:53:43

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;
Add New Block - Content type php script HELP
by cavergary on 2006/10/13 22:43:31

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> <? } ?>

Who's Online

209 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 209


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