Page 1 of 1

parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 7:35 am
by Soliloquy
I wanted to add GoogleAds to my header without violating AdSense TOS, so I used a template conditional to load the AdSense code only if it was the index, viewforum, or viewtopic:

Code: Select all


<!-- IF S_INDEX -->
<tr>
<td colspan="2" align="center">

<script type="text/javascript"><!--
google_ad_client = "pub-xxxxx";
/* BigBang  728x90 */
google_ad_slot = "3872613241";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</td>
</tr>
<!-- ENDIF --> 
(same with S_VIEWFORUM and S_VIEWTOPIC)

I also had to add the variables into the template php files, for the instance into index.php:

Code: Select all

'S_INDEX'            => true, 
I refreshed the templates and for a brief shining moment, I had it working on the index file. Then I repeated the process for viewforum and viewtopic; nothing happened, so I refreshed the templates. Now I keep getting error messages, even after I restored all files to their original conditions and tried to refresh again:

Parse error: syntax error, unexpected $end in /home/theory/public_html/includes/template.php(187) : eval()'d code on line 173
How can I get this working again?

Re: parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 7:40 am
by karlsemple
I restored all files to their original conditions and tried to refresh again:
IF you have restored the originals you would need to purge the cached versions from the database to reflect the restored files, this script here will allow you to do this and should get the board working again so you can then try to get this working :)

Re: parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 8:28 pm
by Soliloquy
Hi Karl,
I tried that but it didn't work. I was still able to log on to my admin panel and try to refresh the template, I'm just still getting an error instead of index.php. (viewtopic and viewforum are working fine.) This time the error is:
Parse error: syntax error, unexpected $end in /home/theory/public_html/cache/tpl_Macinscott-3_index_body.html.php on line 173
I don't think I even touched index_body.html, but I reuploaded the original anyway and refreshed the template, and still no luck. :(

Any more ideas would be appreciated!

Re: parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 8:36 pm
by Erik Frèrejean
The error message suggests that you've edited that file and forgot to close a block or switch. Can you post the content of that file here? (enclosed in code tags!)

Re: parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 8:45 pm
by Soliloquy
Here's the index_body file I'm using:

Code: Select all

<!-- INCLUDE overall_header.html -->

<!-- IF U_MCP -->
	<div id="pageheader">
		<p class="linkmcp">[ <a href="{U_MCP}">{L_MCP}</a> ]</p>
	</div>

	<br clear="all" /><br />
<!-- ENDIF -->

<!-- IF not S_USER_LOGGED_IN -->
	<br clear="all" />

	<form method="post" action="{S_LOGIN_ACTION}">
<div class="tblminitopleft"><div class="tblminitopright"><div class="tblminitop"><div class="tblminititle"><span class="tblminititle"><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></div></div></div></div>
	
	<table class="tablebg" width="100%" cellspacing="1">

	<tr>
		<td class="row1" align="center"><span class="genmed">{L_USERNAME}:</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}:</span> <input class="post" type="password" name="password" size="10" />&nbsp; <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
	</tr>
	</table>
	{S_FORM_TOKEN}
	</form>
<div class="tblshadleft"><div class="tblshadright"><div class="tblshad"></div></div></div>

<!-- ENDIF -->

<!-- INCLUDE forumlist_body.html -->

		<table width="100%" cellspacing="0">
		<tr>
			<td class="gensmall"><!-- IF not S_IS_BOT --><a href="{U_DELETE_COOKIES}">{L_DELETE_COOKIES}</a><!-- ENDIF --> | <a href="{U_TEAM}">{L_THE_TEAM}</a></td>
			
		</tr>
		</table>
<br />

<br clear="all" />

<!-- INCLUDE breadcrumbs.html -->

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<br clear="all" />

<div class="tbltopleft"><div class="tbltopright"><div class="tbltop"><div class="tbltitle"><span class="tbltitle">About this forum</div></div></div></div>

	<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<td class="cat" colspan="2" align="center"><!-- IF U_VIEWONLINE --><h4><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h4><!-- ELSE --><h4>{L_WHO_IS_ONLINE}</h4><!-- ENDIF --></td>
	</tr>
	<tr>
	<!-- IF LEGEND -->
		<td class="row1" rowspan="2" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<!-- ELSE -->
		<td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<!-- ENDIF -->
		<td class="row1" width="100%"><span class="genmed">{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /><br />{LOGGED_IN_USER_LIST}</span></td>
	</tr>
	<!-- IF LEGEND -->
		<tr>
			<td class="row1"><b class="gensmall">{L_LEGEND} :: {LEGEND}</b></td>
		</tr>
	<!-- ENDIF -->

<!-- ENDIF -->

<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
	<tr>
		<td class="cat" colspan="2" align="center"><h4>{L_BIRTHDAYS}</h4></td>
	</tr>
	<tr>
		<td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/birthday.gif" alt="{L_BIRTHDAYS}" /></td>
		<td class="row1" width="100%"><p class="genmed"><!-- IF BIRTHDAY_LIST -->{L_CONGRATULATIONS}: <b>{BIRTHDAY_LIST}</b><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p></td>
	</tr>

<!-- ENDIF -->

<tr>
	<td class="cat" colspan="2" align="center"><h4>{L_STATISTICS}</h4></td>
</tr>
<tr>
	<td class="row1"><img src="{T_THEME_PATH}/images/statistics.gif" alt="{L_STATISTICS}" /></td>
	<td class="row1" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {NEWEST_USER}</p></td>
</tr>
</table>
<div class="tblbttmleft"><div class="tblbttmright"><div class="tblbttm"><div class="tblfooter"><a href="{U_MARK_FORUMS}" class="tblfooter">{L_MARK_FORUMS_READ}</a></div></div></div></div>

<!-- IF not S_USER_LOGGED_IN -->
	<br clear="all" />

	<form method="post" action="{S_LOGIN_ACTION}">
<div class="tblminitopleft"><div class="tblminitopright"><div class="tblminitop"><div class="tblminititle"><span class="tblminititle"><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></div></div></div></div>
	
	<table class="tablebg" width="100%" cellspacing="1">

	<tr>
		<td class="row1" align="center"><span class="genmed">{L_USERNAME}:</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}:</span> <input class="post" type="password" name="password" size="10" />&nbsp; <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
	</tr>
	</table>
	{S_FORM_TOKEN}
	</form>
<div class="tblshadleft"><div class="tblshadright"><div class="tblshad"></div></div></div>

<!-- ENDIF -->

<table align="center" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td align="center">


			<table class="legend">
<tr>
	<td width="20" align="center">{FORUM_NEW_IMG}</td>
	<td><span class="gensmall">{L_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center">{FORUM_IMG}</td>
	<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center">{FORUM_LOCKED_IMG}</td>
	<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr>
</table>

		</td>
	</tr>
	</table>



<!-- INCLUDE overall_footer.html -->

Re: parse error unexpected $end on line 173

Posted: Wed Apr 22, 2009 8:55 pm
by Erik Frèrejean
I'm not sure how you got that may lines in that cache file. The best thing to do is to ask this in the release topic of that specific style as the author will be in the best position to help you.

Re: parse error unexpected $end on line 173

Posted: Thu Apr 23, 2009 3:55 am
by poplarman
Hi,
Make sure you've uploaded the file in Binary mode.
Bob_H

Re: parse error unexpected $end on line 173

Posted: Thu Apr 23, 2009 8:23 am
by Erik Frèrejean
The problem isn't in the template file, but in the cached version of that file. The cache file shouldn't be uploaded as it is generated by phpBB.

Re: parse error unexpected $end on line 173

Posted: Thu Apr 23, 2009 10:09 pm
by Soliloquy
I made sure the template was uploaded in binary mode and refreshed it again to no avail. Then I clicked on Cache and deleted just the index_body template and finally, it worked. Now I wonder if I dare try adding the ads again :) Thanks to all who helped!