News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Need help with Parse Error!

Started by TheBeavertownKid, January 01, 2011, 08:06:28 PM

Previous topic - Next topic

TheBeavertownKid

Whats going on guys and gals? I get the following error when I click on any topics in my forums:

"Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in .../Themes/default/Display.template.php on line 171"

This is what that area looks like:
169: $normal_buttons = array(
170: 'reply' => array('test' => 'can_reply', 'text' => 146, 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies']),
171: 'notify' => array('test' => 'can_mark_notify', 'text' => 125, 'image' => 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(Â¥'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . 'Â¥');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),
172: 'custom' => array(),
173: 'send' => array('test' => 'can_send_topic', 'text' => 707, 'image' => 'sendtopic.gif', 'lang' => true, 'url' => $scripturl . '?action=sendtopic;topic=' . $context['current_topic'] . '.0'),
174: 'print' => array('text' => 465, 'image' => 'print.gif', 'lang' => true, 'custom' => 'target="_blank"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
175: );

Ashley S

'notify' => array('test' => 'can_mark_notify', 'text' => 125, 'image' => 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(Â¥'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . 'Â¥');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'])),

Try that i ain't promising it will work but make sure you save a copy before editing the file ;).
I added another ) at the end.

TheBeavertownKid

Quote from: Ashley S on January 01, 2011, 08:13:54 PM
'notify' => array('test' => 'can_mark_notify', 'text' => 125, 'image' => 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(Â¥'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . 'Â¥');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'])),

Try that i ain't promising it will work but make sure you save a copy before editing the file ;).
I added another ) at the end.
Nope didnt work

Ashley S

Can i ask, What files have you edited & what modifications you have added ;).

TheBeavertownKid

Quote from: Ashley S on January 01, 2011, 08:22:54 PM
Can i ask, What files have you edited & what modifications you have added ;).

I went to ad an AdSense ad and it didnt work so I deleted the code back to stock but I guess I may have missed something...

Does this look right and stock to you?
// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div class="signature">', $message['member']['signature'], '</div>';

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';
        }
echo '
<tr><td style="padding: 0 0 1px 0;"></td></tr>
</table>
<a name="lastPost"></a>';


I added the code for AdSense right behind the "}" just above the line "echo '". I may have accidentally deleted something else that used to be there also.

Ashley S


TheBeavertownKid

Quote from: Ashley S on January 01, 2011, 08:29:11 PM
Which SMF version you using?

1.1.12 Maybe if I had a Stock display.index.php for the default theme I can just replace it since that was the only thing I edited.

Ashley S

That code you sent me there is fine nothing wrong with it. Your best bet is delete that file and re-add it with the attachment i have added to this post.

Bare in mind make a copy of that file first ;).

TheBeavertownKid

Quote from: Ashley S on January 01, 2011, 08:37:07 PM
That code you sent me there is fine nothing wrong with it. Your best bet is delete that file and re-add it with the attachment i have added to this post.

Bare in mind make a copy of that file first ;).

Youre a life saver Ash! Thanks a ton. That worked! I wonder what happened?? Hmmm.........

Ashley S

You was missing one of the tables in the code :P.

</tr>
</table>
</td>
;)

MrPhil

There's some strangeness in the middle of line 171:
'custom' => 'onclick="return confirm(Â¥'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . 'Â¥');"',
You've got 2 odd characters (are they a single UTF-8 character?), a single ' to end the string, and then immediately another '. I suspect, from the context, that you want
'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"',
The two bytes Â¥ are the Latin-1 representation of the UTF-8 code for a Yen symbol ¥, so I'm not sure what the intent is there -- are they garbage, or is there supposed to be a string before and after the text? I replaced them by escaped ' single quotes, so that the text will have quotes wrapped around it. That may have been what was there originally, but it got corrupted somewhere along the line. Give it a try.

Advertisement: