HELP with POLL code!!!

Started by Angelotus, February 09, 2009, 06:16:00 AM

Previous topic - Next topic

Angelotus

Hi, I can't get this code starting to work in display.template.php
I get a template parse error (unexpected ';')


// POLL
   if ($context['is_poll'])
   {
      echo '<div class="block-head"></div>
            <div class="block-middle">';

      echo '<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" style="vertical-align:middle;"/>Peiling bij dit onderwerp<hr />';
      echo 'Vraag: ', $context['poll']['question'], '<br />';
      if (!empty($context['poll']['expire_time']))
         echo '
               &nbsp;(', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ': ', $context['poll']['expire_time'], ')';

      // Are they not allowed to vote but allowed to view the options?
      if ($context['poll']['show_results'] || !$context['allow_vote'])
      {
         echo '<table class="collapse">';

            // Show each option with its corresponding percentage bar.
         foreach ($context['poll']['options'] as $option)
            echo '
                     <tr>
                        <td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
                        <td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
                     </tr>';

         echo '</table>';

         // If they are allowed to revote - show them a link!
         if ($context['allow_change_vote'])
            echo '<br />
               <a href="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], ';sesc=', $context['session_id'], '">', $txt['poll_change_vote'], '</a>';

         // If we're viewing the results... maybe we want to go back and vote?
         if ($context['poll']['show_results'] && $context['allow_vote'])
            echo '<br />
                  <a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_return_vote'], '</a>';

         // If they're allowed to lock the poll, show a link!
         if ($context['poll']['lock'])
            echo '<br />
                  <a href="', $scripturl, '?action=lockVoting;topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">sluiten/heropenen</a>';

         // If they're allowed to edit the poll... guess what... show a link!
         if ($context['poll']['edit'])
            echo '<br />
                  <a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">edit</a>';

         echo '', $context['allow_poll_view'] ? '
            <br />
               <b>Totaal aantal stemmen: ' . $context['poll']['total_votes'] . '</b>';
      }
      // They are allowed to vote! Go to it!
      else
      {
         echo '
         <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
            <table class="collapse">
               <tr>
                  <td>';

         // Show a warning if they are allowed more than one option.
         if ($context['poll']['allowed_warning'])
            echo '
                     ', $context['poll']['allowed_warning'], '
                  </td>
               </tr><tr>
                  <td>';

         // Show each option with its button - a radio likely.
         foreach ($context['poll']['options'] as $option)
            echo '
                     ', $option['vote_button'], ' ', $option['option'], '<br />';

         echo '
                  </td>
                  </tr></table>';

         // Allowed to view the results? (without voting!)
         if ($context['allow_poll_view'])
            echo '<br />
                     <a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';viewResults">Resultaten Bekijken</a>';

         // Show a link for locking the poll as well...
         if ($context['poll']['lock'])
            echo '<br />
                     <a href="', $scripturl, '?action=lockVoting;topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', (!$context['poll']['is_locked'] ? $txt['smf30'] : $txt['smf30b']), '</a>';

         // Want to edit it? Click right here......
         if ($context['poll']['edit'])
            echo '<br />
                     <a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['smf39'], '</a>';

            echo '
                  <input class="submit" type="submit" value="Verzenden" />
            <input type="hidden" name="sc" value="', $context['session_id'], '" />
         </form>';
      }

      echo '
      </div><div class="block-bottom"></div>';
   }


Help please!!!

karlbenson

on what line?
might be easier to attach the whole file your editing.

Angelotus

#2
It is only this code that is wrong. It does not say on which line the error occurs.

Neorics

[For Hire] I can help you with anything regarding Simple Machines Forum  ~ My Portfolio

Yağız...

Find:
echo '', $context['allow_poll_view'] ? '
            <br />
               <b>Totaal aantal stemmen: ' . $context['poll']['total_votes'] . '</b>';

Replace with:
         echo '', $context['allow_poll_view'] ? '
            <br />
               <b>Totaal aantal stemmen: ' . $context['poll']['total_votes'] . '</b>' : '';

Rumbaar

Did that modification help?

If not, where exactly are you placing the code within the file, maybe attach it.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: