Support Forums
PHP error - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: PHP error (/showthread.php?tid=1973)



PHP error - R3c0nna1ssanc3 - 10-21-2009

I used a plug in to enable PHP in a mybb forum. When I put in this code.

PHP Code:
<?php if($this->params->get('dateDisplay')) : ?><div id="date"><?php echo date('l dS \of F Y'); ?>&nbsp;&nbsp;&nbsp;&nbsp;</div><?php endif; ?>

The date is working fine but I got two errors I got rid of one by taking out

PHP Code:
<?php endif; ?>

But im still left with this.

Code:
Parse error: syntax error, unexpected $end in /home/content/41/4149141/html/forum/global.php(438) : eval()'d code(7) : eval()'d code on line 1

If you would like to see the error here is the link to the forum

http://www.datapodcomputer.com/forum/


RE: PHP error - MAcar - 10-21-2009

Idk what the problem is but it just might be the way your formatted it
also do you want it to display the date everytime? if so try this
PHP Code:
<?php
echo '<div id="date">';
echo 
date('l dS \of F Y');
echo 
"&nbsp;&nbsp;&nbsp;&nbsp;</div>";
?>
if you want it to use the if (which is where your error might be) use this
PHP Code:
<?php
if($this->params->get('dateDisplay')){
echo 
'<div id="date">';
echo 
date('l dS \of F Y');
echo 
"&nbsp;&nbsp;&nbsp;&nbsp;</div>";
}
?>



RE: PHP error - R3c0nna1ssanc3 - 10-21-2009

its not working when I input the code and hit save the entire header file


RE: PHP error - R3c0nna1ssanc3 - 10-21-2009

I justed youed the predefined date code from mybb and then coded it into the homepage


RE: PHP error - h1r0n - 10-22-2009

the error is caused by a missing parameter I guess.. did you put the timestamp??

PHP Code:
time();