Unexpected $end in complied template.

3 views
Skip to first unread message

wlasson

unread,
Mar 3, 2009, 6:27:58 PM3/3/09
to Photon Framework
I've got an error here that has been racking my brain for about 30
minutes, and I know if I have another set of eyes that takes a look at
it, you'll probably get it in no time.

For some reason on my compiled code, I'm getting an error:

Parse error: syntax error, unexpected $end in /var/www/mcms/pages/
compile/%2Fadmin%2Finstall%2Findex.phtml on line 49

I tried just getting rid of that file to actually force it to re-
compile, it still didn't work. I've gone back through any files that
are included or linked to that actual template and it appears to be
all in working order with no syntax errors. Is this generally thrown
from a syntax error, or would this be an actual bug?

Thanks in advance,

Wade

Alvaro Carrasco

unread,
Mar 3, 2009, 6:38:49 PM3/3/09
to wlasson, Photon Framework
See below:

wlasson wrote:
> I've got an error here that has been racking my brain for about 30
> minutes, and I know if I have another set of eyes that takes a look at
> it, you'll probably get it in no time.
>
> For some reason on my compiled code, I'm getting an error:
>
> Parse error: syntax error, unexpected $end in /var/www/mcms/pages/
> compile/%2Fadmin%2Finstall%2Findex.phtml on line 49
>
>

Can you post the template and the compiled file?


> I tried just getting rid of that file to actually force it to re-
> compile, it still didn't work. I've gone back through any files that
> are included or linked to that actual template and it appears to be
> all in working order with no syntax errors. Is this generally thrown
> from a syntax error, or would this be an actual bug?
>

It's a syntax error on the compiled file. I haven't seen this before
with the ptag compiler, it might be a bug.
> Thanks in advance,
>
> Wade

Alvaro

wlasson

unread,
Mar 3, 2009, 7:11:14 PM3/3/09
to Photon Framework
Sure, here is the template file ( just ignore my crappy coding ;) ):

<?php
$step =& $_REQUEST['step'];
?>
<p:InstallerPage title='{$this->title}'>
<p:Header>
</p:Header>
<?php
// When they first hit the installer page.
if (empty($step)) {
print $this->lang['install_welcome'].'<br/><br/>';
if ($this->installer->FirstTime())
print $this->lang['install_firsttime'];
else
print $this->lang['install_version'].$this->installer-
>currentVersion;
?>
<form action="<?php print $this->link("/admin/install/index?
step=1");?>" method="post">
<input type="submit" value="Next ->" />
</form>
<?php
}
// They are on to step 1 of the installer.
else if ($step == 1) {
print $this->lang['install_requirements'];
?>
<table>
<tr><td>PHP Version: </td><td></td><?php $this->installer->checkPHP
(); ?></tr>
</table>
<?php

?>
}
?>
</p:InstallerPage>


Here is the Compiled Version:

<?$_template_vars=array()?><?php
$step =& $_REQUEST['step'];
?>
<?php ob_start()?>
<?php ob_start()?>
<?php
$c = ob_get_clean();
if (!class_exists('HeaderPTag')) {
PTagViewRenderer::compileTag('Header', '/var/www/mcms/pages/tags', '/
var/www/mcms/pages/compile');
}
require_once '/var/www/mcms/pages/compile/tags/Header.phtml';
HeaderPTag::render($c, array_merge(array (
), array()));
?>
<?php
// When they first hit the installer page.
if (empty($step)) {
print $this->lang['install_welcome'].'<br/><br/>';
if ($this->installer->FirstTime())
print $this->lang['install_firsttime'];
else
print $this->lang['install_version'].$this->installer-
>currentVersion;
?>
<form action="<?php print $this->link("/admin/install/index?
step=1");?>" method="post">
<input type="submit" value="Next ->" />
</form>
<?php
}
// They are on to step 1 of the installer.
else if ($step == 1) {
print $this->lang['install_requirements'];
?>
<table>
<tr><td>PHP Version: </td><td></td><?php $this->installer->checkPHP
(); ?></tr>
</table>
<?php

?>
}
?>
<?php
$c = ob_get_clean();
if (!class_exists('InstallerPagePTag')) {
PTagViewRenderer::compileTag('InstallerPage', '/var/www/mcms/pages/
tags', '/var/www/mcms/pages/compile');
}
require_once '/var/www/mcms/pages/compile/tags/InstallerPage.phtml';
InstallerPagePTag::render($c, array_merge(array (
), array('title' => $this->title)));
?>

Alvaro Carrasco

unread,
Mar 3, 2009, 7:21:59 PM3/3/09
to wlasson, Photon Framework
Wade,

At the bottom of the template you have an extra '?>':


</table>
<?php

?> <------------ remove this line
}
?>
</p:InstallerPage>


Hopefully that's the problem. I should add something to the framework to
catch things like this easier.

Alvaro

wlasson

unread,
Mar 3, 2009, 7:29:59 PM3/3/09
to Photon Framework
Ah, yes that would make complete sense.

I don't know how that could be handled better. The error message
coming form the compiled file kind of misled me, however in the back
of my mind i knew it was a syntax error. Maybe you're right and there
would be an easy way of checking opens/closes and making sure they
all line up, if not photon could throw the error and let the user
know something didn't match up and in what file?

Thanks for the help, it's awesome getting to know this framework in-
and-out.
Reply all
Reply to author
Forward
0 new messages