I want to let my visitor to embed polls

Started by cong, August 31, 2008, 11:35:34 PM

Previous topic - Next topic

cong

hello

i hope this is the place for my qustion


I want the visitors to embed polls in to thier sites
embed space beside polls Like the following image

____________________________________________________________

____________________________________________________________




then visitor of my site can copy & paste this code to his site and get poll in his site Like the following image
____________________________________________________________

____________________________________________________________





when his visitors vote the result shown in my forum like the following image
____________________________________________________________

____________________________________________________________




I hope there is mod or plugin for that
if there is not plugin or mod for that how can i do this ?

thanx in advance

Kindred

I can't see the "embed" image... it's too small.
I have also never specifically seen that as a mod.

The display of the poll looks like a TinyPortal block...

the results is standard smf.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

i made it with photoshop it just say the concept

so no solution to this problem ??

i want it

i am ready to pay money to who do it

Kindred

I still do not understand.

What do you expect the "embed" section to do?


I have already told you that the poll display can be done with TinyPortal and the results display is standard SMF functionality.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

DonGiovanni

If i understood. He need this code that other users can embed to their page.

cong

#5
Quote from: DonGiovanni on September 01, 2008, 03:07:14 PM
If i understood. He need this code that other users can embed to their page.

yes you are right i need users to copy and paste code to embed  poll to their page

what is TinyPortal >> sorry i am beginner

i am ready to  pay money to anyone who ready to solve this problem for me

Kindred

wait...   you want a code to allow other users to post your forums polls on other pages?

Nope. can not do it.  SMF is not designed to be used that way.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

Quote from: Kindred on September 01, 2008, 06:23:48 PM
wait...   you want a code to allow other users to post your forums polls on other pages?

Nope. can not do it.  SMF is not designed to be used that way.

this is not agree with smf  license ?

Kindred

it has nothing to do with the license.

SMF is not programatically designed to be used across multiple sites. Even SSI function only work on the same server/main domain.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

Quote from: Kindred on September 01, 2008, 07:15:10 PM
it has nothing to do with the license.

SMF is not programatically designed to be used across multiple sites. Even SSI function only work on the same server/main domain.

so programmers can't do this ?

cong

i will clear what i want to do
may be there is miss understand

lets say i Have
website "A" >> run smf
another "B" >> this is the external websites that users will embed the polls there

when the webmaster take code from "A" he put it in "B"
Then visitors of "B" will just choose from poll choices then click vote when they click vote they go to results in "A"

may be now you understand me

i think this is easy fr programmers

Kindred

and the answer is NO, it is not easy for programmers.   SMF is not intended to be used like that and has no functionality for embedding polls into another site, nor for collecting the data from that site.

SMF is a forum that is intended to be run on a single site/domain. Although you can display posts, etc via RSS, there is no way to send back data.

My first impression was that you wanted to do this all from within your site.  Now that you have explained, I will tell you that it can not be easily done... if it can be done at all.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong


Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

just the poll that will be in  Ifram  not all the forums

just when vistor click on vote he will go to smf

Kindred

Quote from: Kindred on September 02, 2008, 07:50:48 AM
smf does not work in iframes

the poll is part of smf.
I will say again...

Quote from: Kindred on September 01, 2008, 07:58:22 PM
and the answer is NO, it is not easy for programmers.   SMF is not intended to be used like that and has no functionality for embedding polls into another site, nor for collecting the data from that site.

SMF is a forum that is intended to be run on a single site/domain. Although you can display posts, etc via RSS, there is no way to send back data.

In other words, you CAN NOT do what you are asking, without MAJOR coding.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong


what is major coding ?

you mean paid one i am ready for this

where i can find coder for this ?

Kindred

If you can find a coder...  go for it.     good luck.

When I say major coding, I mean that I expect that you will need a professional programmer who will have to re-write major portions of code.

basically, SMF's current design does not support what you are trying to do.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

[SiNaN]

You just need a form with the correct information Kindred. You can do it, but note that guests cannot vote in polls in SMF 1.1.5.

../Themes/default/Display.template.php

Find:

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['smf43'], '
</td>


Replace:

$embed = '
<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>
<tr>
<td colspan="2">';

if ($context['poll']['allowed_warning'])
$embed .= '
' . $context['poll']['allowed_warning'] . '
</td>
</tr><tr>
<td>';

foreach ($context['poll']['options'] as $option)
$embed .= '
' . $option['vote_button'] . ' ' . $option['option'] . '<br />';

$embed .= '
</td>
<td valign="bottom" style="padding-left: 15px;">';

$embed .= '
</td>
</tr><tr>
<td colspan="2"><input type="submit" value="' . $txt['smf23'] . '" /></td>
</tr>
</table>
</form>';

$embed = htmlspecialchars($embed);

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['smf43'], '
</td>
<td class="titlebg" valign="middle" style="padding-left: 6px;">
Embed
</td>


Find:

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


Replace:

echo '
</td>
<td class="windowbg">
<textarea rows="5" style="width: 400px;">' . $embed . '</textarea>
</td>
</tr>
</table>';


Also, in SMF 2.0, guests can also vote in polls. It will be better idea to use this with SMF 2.0.
Former SMF Core Developer | My Mods | SimplePortal

aishaweb

Quote from: Kindred on September 01, 2008, 10:11:34 AM
I can't see the "embed" image... it's too small.



What?

The pics are pretty big, just this forum has resized them in the post.

Kindred

[SiNaN],

You missed the point....   Cong wants that form to be used on OTHER sites.  The change that you made will change the display of the poll on the smf site itself...   it won't allow him to post an SMF poll as a block on another site.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

[SiNaN]

:)

Well, if I get things correctly, it will.

I've created a poll. Then on display template, there is poll shown and there is an embed code.

See how I produce the embed code:

  $embed = '
         <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>
               <tr>
                  <td colspan="2">';

   if ($context['poll']['allowed_warning'])
      $embed .= '
                     ' . $context['poll']['allowed_warning'] . '
                  </td>
               </tr><tr>
                  <td>';

   foreach ($context['poll']['options'] as $option)
      $embed .= '
                     ' . $option['vote_button'] . ' ' . $option['option'] . '<br />';

   $embed .= '
                  </td>
                  <td valign="bottom" style="padding-left: 15px;">';

   $embed .= '
                  </td>
               </tr><tr>
                  <td colspan="2"><input type="submit" value="' . $txt['smf23'] . '" /></td>
               </tr>
            </table>
         </form>';

   $embed = htmlspecialchars($embed);


Here is a sample of an embed code displayed in the topic besides poll options:

<form action="http://127.0.0.1/smf/index.php?action=vote;topic=7.0;poll=1" method="post" accept-charset="ISO-8859-1" style="margin: 0px;">
<table>
<tr>
<td colspan="2">
<input type="radio" name="options[]" id="options-0" value="0" class="check" /> Choice 1<br />
<input type="radio" name="options[]" id="options-1" value="1" class="check" /> Choice 2<br />
<input type="radio" name="options[]" id="options-2" value="2" class="check" /> Choice 3<br />
</td>
<td valign="bottom" style="padding-left: 15px;">
</td>
</tr><tr>
<td colspan="2"><input type="submit" value="Submit Vote" /></td>
</tr>
</table>
</form>


When you use that embed code on a usual html page, it will work. The point is, just you post the info to action=vote.
Former SMF Core Developer | My Mods | SimplePortal

Kindred

hmmmm.....   maybe I was wrong.

Of course, if guests can't vote, this won't work.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

[SiNaN] you are great
Thank you very very much

you made me back to light

I tried with my 1.1.5 but guests can't vote but i need gusts to vote and i got many error message

so i download smf 2 now to test your tip on it

i will back and reply you when i test it on smf 2

cong

hey thank you very much sinan

you are very good

thank you also Kindred

The problem is solved

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

cong

your tip is worked good but i found out small problem


i can't see poll question after embed code to external sit ( see the following image )



cong


[SiNaN]

We will, but you should a bit more patient. You know we are all valunteers here and trying to do our best. Bumping topics unless 24 hours passed from the last reply to topic is not a good idea really. :)

The codes I gave was for SMF 1.1.5. I thin you are trying to use them in SMF 2.0. Here what you should use in 2.0;

../Themes/default/Display.template.php

Find:

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['poll'], '
</td>


Replace:

$embed = '
<table>
<tr>
<td>
' . $context['poll']['question'] . '
<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>
<tr>
<td colspan="2">
' . ($context['poll']['allowed_warning'] ? $context['poll']['allowed_warning'] . '
</td>
</tr><tr>
<td>' : '');

foreach ($context['poll']['options'] as $option)
$embed .= '
' . $option['vote_button'] . ' <label for="' . $option['id'] . '">' . $option['option'] . '</label><br />';

$embed .= ' </td>
<td valign="bottom" style="padding-left: 15px;">
</td>
</tr><tr>
<td colspan="2"><input type="submit" value="' . $txt['poll_vote'] . '" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>';

$embed = htmlspecialchars($embed);

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['poll'], '
</td>
      <td class="titlebg" valign="middle" style="padding-left: 6px;">
         Embed
      </td>


Find:

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


Replace:

echo '
</td>
      <td class="windowbg">
            <textarea rows="5" style="width: 400px;">' . $embed . '</textarea>
      </td>
</tr>
</table>';
Former SMF Core Developer | My Mods | SimplePortal

cong

ok thank you very much i saw you online put i didn't pm u as you said in your sig

so now i c what u say

thank you very much for your great help

SmittyNY

Check out JS-Kit.com. You can copy and paste their scripts in between HTML tags. [ html] [ /html] This is the easiest way I think.

Kindred

1- this is an old post that has already been solved
2- you didn't read...   he wants to post SMF polls from his forum on OTHER sites.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

cong

Quote from: [SiNaN] on September 05, 2008, 07:34:21 PM
We will, but you should a bit more patient. You know we are all valunteers here and trying to do our best. Bumping topics unless 24 hours passed from the last reply to topic is not a good idea really. :)

The codes I gave was for SMF 1.1.5. I thin you are trying to use them in SMF 2.0. Here what you should use in 2.0;

../Themes/default/Display.template.php

Find:

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['poll'], '
</td>


Replace:

$embed = '
<table>
<tr>
<td>
' . $context['poll']['question'] . '
<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>
<tr>
<td colspan="2">
' . ($context['poll']['allowed_warning'] ? $context['poll']['allowed_warning'] . '
</td>
</tr><tr>
<td>' : '');

foreach ($context['poll']['options'] as $option)
$embed .= '
' . $option['vote_button'] . ' <label for="' . $option['id'] . '">' . $option['option'] . '</label><br />';

$embed .= ' </td>
<td valign="bottom" style="padding-left: 15px;">
</td>
</tr><tr>
<td colspan="2"><input type="submit" value="' . $txt['poll_vote'] . '" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>';

$embed = htmlspecialchars($embed);

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="padding-top: 0; margin-bottom: 2ex;">
<tr>
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['poll'], '
</td>
      <td class="titlebg" valign="middle" style="padding-left: 6px;">
         Embed
      </td>


Find:

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


Replace:

echo '
</td>
      <td class="windowbg">
            <textarea rows="5" style="width: 400px;">' . $embed . '</textarea>
      </td>
</tr>
</table>';



This solution not working now after upgrade to the latest version SMF 2.0 Beta 4

i can't find now the codes in Display.template.php
so may be the solution need update

thank you in advance

cong

I found the difference between the latest two versions in things like
<h3 class="titlebg headerpadding">
instead of
<td class="titlebg" colspan="2" valign="middle" style="padding-left: 6px;">

but i am newbie to php and smf
so plz anyone modify sinan reply
http://www.simplemachines.org/community/index.php?topic=258947.msg1691993#msg1691993
to be working with the latest version  SMF 2.0 Beta 4
plz i need it

cong

please anyone tell me if my problem with the latest version is not understood

[SiNaN]

Please, do not bump your topics unless 24 hours passed from the last reply.

Display.template.php

Find:

echo '
</div>
</div>';
}

// Does this topic have some events linked to it?


Replace:

echo '
</div>
<h3 class="titlebg headerpadding">
<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" />Embed Codes
</h3>
<div class="windowbg clearfix" id="poll_options">
', $embed,'
</div>
</div>';
}

// Does this topic have some events linked to it?


Find:

if ($context['is_poll'])
{


Replace:

if ($context['is_poll'])
{
      $embed = '
<table>
   <tr>
      <td>
         ' . $context['poll']['question'] . '
         <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>
               <tr>
                  <td colspan="2">
                     ' . ($context['poll']['allowed_warning'] ? $context['poll']['allowed_warning'] . '
                  </td>
               </tr><tr>
                  <td>' : '');

      foreach ($context['poll']['options'] as $option)
         $embed .= '
                     ' . $option['vote_button'] . ' <label for="' . $option['id'] . '">' . $option['option'] . '</label><br />';

      $embed .= '                  </td>
                  <td valign="bottom" style="padding-left: 15px;">
                  </td>
               </tr><tr>
                  <td colspan="2"><input type="submit" value="' . $txt['poll_vote'] . '" /></td>
               </tr>
            </table>
         </form>
      </td>
   </tr>
</table>';

   $embed = htmlspecialchars($embed);
Former SMF Core Developer | My Mods | SimplePortal

cong

thank u mr sinan for your reply but there is a problem

the code doesn't shown in scrolled textarea like the previous solution

you can see this image to state the problem



[SiNaN]

Sorry.

Now,

Find:

      ', $embed,'

Replace:

      <textarea rows="5" style="width: 400px;">', $embed,'</textarea>
Former SMF Core Developer | My Mods | SimplePortal

cong

thank you sinan

the last thing i want the code to be beside the poll not under the poll

Like the solution you did before in the previous version

as the image shown





[SiNaN]

Okay...

Find:

<div class="tborder marginbottom" id="poll">

Replace:

<table>
<tr>
<td style="width: 100%">
<div class="tborder marginbottom" id="poll">


Find:

      echo '
   </div>
   <h3 class="titlebg headerpadding">
      <img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" />Embed Codes
   </h3>
   <div class="windowbg clearfix" id="poll_options">
      <textarea rows="5" style="width: 400px;">', $embed,'</textarea>
   </div>
</div>';


Replace:

      echo '
   </div>
</div>
</td>
<td style="width: 50%;">
<div class="tborder marginbottom" id="poll">
   <h3 class="titlebg headerpadding">
      <img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" />Embed Codes
   </h3>
   <div class="windowbg clearfix" id="poll_options">
      <textarea rows="5" style="width: 400px;">', $embed,'</textarea>
   </div>
</div>
</td>
</tr>
</table>';
Former SMF Core Developer | My Mods | SimplePortal

cong

the words can't describe how you are very good man

thank you sinan

wc

Guys,

I might be going slightly off-topic, but it is still a question about Polls and related to something that was mentioned earlier in this thread. Here goes:

I just started using smf and I have been unable to give guests the capability to vote in polls. How can I enable this setting? I went to "Admin" -> "Permissions" -> "Permissions By MemberGroup" and there I checked the Guest group checkbox, selected "Vote in polls" and clicked "Set Permissions". This increased my permission count for Guests group from 4 to 5.

However, guests still do not see the radiobuttons in the poll. They can reply to the post/poll itself, but I think that is probably because I checked "Post replies to topics" -> "Any Topic" under Guest membergroup' General Permissions. I suspect that this is related to me not being able see "Vote polls" for Guests (unlike other MemberGroups) under "Polls" just like I see "View polls", "Post polls", "Add poll to topics", etc. Have I set some master permission incorrectly?

I believe I had originally installed 1.1.5 and later upgraded to 1.1.7. This is what I see under "Admin" -> "Administration Center"

Support Information
Version Information:
Forum version: SMF 1.1.7
Current SMF version: SMF 1.1.7


Any help would be appreciated.

Thanks

Kindred

since the poll records the vote by user, guests can never vote in polls...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: