Im Getting Template Parse Error - Please Help?

Started by swiftmed, May 12, 2010, 02:18:45 PM

Previous topic - Next topic

swiftmed

Hey Guys,

I am trying to insert the Facebook Like Button code into my template - it works absolutely fine if i place the code under the poster information section, but I want the button to display under the line just above where the post starts and below the title.

Heres the code around that area:
// Show the post itself, finally!
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
</td>
</tr>';


Here is the code I am trying to use:

// Show the post itself, finally!
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
if ($context['first_message']==$message['id'])
echo'

<br/><br/>
<script type="text/javascript">
tweetmeme_style = \'compact\';
tweetmeme_source = \'swiftmed\';
tweetmeme_service = \'bit.ly\';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

<iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?topic=', $context['current_topic'], '&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>
';
<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
</td>
</tr>';


Which is displaying this error (attached image).

Could anybody give me the correct code I should be using to achieve this please?
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

SoLoGHoST

Take a look at the code just before that line of the error message...

</tr></table>
                     <hr width="100%" size="1" class="hrcolor" />


You never closed the echo statement, this happens all too often...

Should be like this instead:
</tr></table>
                     <hr width="100%" size="1" class="hrcolor" />';

swiftmed

Thanks for the reply - I did as you said and closed the statement, and am now getting this error (see picture)

With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

swiftmed

A slightly clearer image of the error message in my last post...
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Mick.

Try this:

      // Show the post itself, finally!
      echo '
                        </td>
                     </tr></table>
                     <hr width="100%" size="1" class="hrcolor" />';
                     if ($context['first_message']==$message['id'])
echo'

<br/><br/>
<script type="text/javascript">
tweetmeme_style = \'compact\';
tweetmeme_source = \'swiftmed\';
tweetmeme_service = \'bit.ly\';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

<iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?topic=', $context['current_topic'], '&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>

                     <div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
                     <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
                  </td>
               </tr>';

swiftmed

Quote from: bluedevil on May 12, 2010, 02:38:03 PM
Try this:

      // Show the post itself, finally!
      echo '
                        </td>
                     </tr></table>
                     <hr width="100%" size="1" class="hrcolor" />';
                     if ($context['first_message']==$message['id'])
echo'

<br/><br/>
<script type="text/javascript">
tweetmeme_style = \'compact\';
tweetmeme_source = \'swiftmed\';
tweetmeme_service = \'bit.ly\';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

<iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?topic=', $context['current_topic'], '&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>

                     <div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
                     <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
                  </td>
               </tr>';


Ahhh, sir, you are a legend!! That fixed the problem and all is now working perfectly. Thank you very very much!!
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Mick.

Quote from: swiftmed on May 12, 2010, 02:40:39 PM
Quote from: bluedevil on May 12, 2010, 02:38:03 PM
Try this:

      // Show the post itself, finally!
      echo '
                        </td>
                     </tr></table>
                     <hr width="100%" size="1" class="hrcolor" />';
                     if ($context['first_message']==$message['id'])
echo'

<br/><br/>
<script type="text/javascript">
tweetmeme_style = \'compact\';
tweetmeme_source = \'swiftmed\';
tweetmeme_service = \'bit.ly\';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

<iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?topic=', $context['current_topic'], '&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>

                     <div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
                     <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
                  </td>
               </tr>';


Ahhh, sir, you are a legend!! That fixed the problem and all is now working perfectly. Thank you very very much!!

No problem man.  The setback on this simple fb script is, the like button will show on hidden boards to guest.  If your users like it, it will show a "login" link in their fb profile instead of the name of the thread.

My mod has board permission for that matter.   

swiftmed

Quote from: bluedevil on May 12, 2010, 02:44:43 PM
Quote from: swiftmed on May 12, 2010, 02:40:39 PM
Quote from: bluedevil on May 12, 2010, 02:38:03 PM
Try this:

      // Show the post itself, finally!
      echo '
                        </td>
                     </tr></table>
                     <hr width="100%" size="1" class="hrcolor" />';
                     if ($context['first_message']==$message['id'])
echo'

<br/><br/>
<script type="text/javascript">
tweetmeme_style = \'compact\';
tweetmeme_source = \'swiftmed\';
tweetmeme_service = \'bit.ly\';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

<iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?topic=', $context['current_topic'], '&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden;"></iframe>

                     <div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
                     <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
                  </td>
               </tr>';


Ahhh, sir, you are a legend!! That fixed the problem and all is now working perfectly. Thank you very very much!!

No problem man.  The setback on this simple fb script is, the like button will show on hidden boards to guest.  If your users like it, it will show a "login" link in their fb profile instead of the name of the thread.

My mod has board permission for that matter.

Ahh I see. Well my forum isnt particularly huge, just around 25k posts and 400 users, so ill use this mod for the minute, then when your mod goes official, I can update my code with your one. But thanks again for your help, its very much appreciated.
With Regards,
Andrew MacDonald

http://cherylanncole.co.uk/forums
SMF 2.0 RC2

Advertisement: