Solved

display xml in wordpress page

Posted on 2011-09-20
18
344 Views
Last Modified: 2012-05-12
I'm using polldaddy and in their api docs, I can use the following to display poll results (:

<?xml version='1.0' encoding='utf-8' ?>
<pd:pdRequest xmlns:pd='http://api.polldaddy.com/pdapi.xsd' partnerGUID='1234567890'>
      <pd:userCode>1234567890</pd:userCode>
      <pd:demands>
            <pd:demand id='GetPollResults'>
                  <pd:poll id='1234567890'/>
            </pd:demand>
      </pd:demands>
</pd:pdRequest>

However, what do I need to display those results?  I currently have php execution installed but not sure what other plugins I need to pull in those results.  Also, if the above code needs php tags around it.

Any ideas experts?
0
Comment
Question by:COwebmaster
  • 12
  • 6
18 Comments
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
This slideshare says that PollDaddy has a button for exporting to WordPress. I've never used PollDaddy, but it sounds like this slide knows what it's talking about:
http://www.slideshare.net/buffyjhamilton/how-to-embed-a-poll-daddy-poll-into-your
0
 

Author Comment

by:COwebmaster
Comment Utility
that won't display just the results on a poll though.

Using the api, I should be able to display the results.  Here's an example of the xml:

http://polldaddydev.wordpress.com/getpollresults/

If I paste in that code along with my api, usercode, and poll id, nothing displays.

Any more ideas?
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
I'm setting up a PollDaddy account and I'll play around with it. If I figure it out I'll let you know.
0
 

Author Comment

by:COwebmaster
Comment Utility
okay great!

They give two approaches, JSON and xml here: http://support.polldaddy.com/api/

I'm unfamiliar with both approaches but just want to display the results of any poll I create in a sidebar widget.  I have the pro account.

Poll daddy apparently is located in ireland so tomorrow the support team can give me my usercode but I do have my api key and poll id.  just not sure how I can display those results in the sidebar widget.
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
OK, that wasn't too bad. When I created a poll it asked what embed choices I wanted. I clicked WordPress and it said to download this plug-in:
http://wordpress.org/extend/plugins/polldaddy/

I installed the plug-in and activated it. The next step is to click on the new WordPress Options Panels located in the left side tool-bar. You'll need to add you email and login details for poledaddy and save. It will load your polls after you save the log-in details.

After activating you'll notice it has a pretty nice interface. You can actually modify your current poles ,create new ones, choose a style or change current styles. It also adds a Ratings option that allows you to choose selected posts to allow viewers to rate.

To get the embed code you'll need to click on the very top menu item that says Polls. It will display a list of your polls. Click the link below the name of the poll that says "Embed and Link". I copied the Javascript code. Next I went to Appearance>Widgets and placed a text widget in my sidebar. Paste the code you copied into the WordPress text widget and save. You can now go to your site that has sidebars and you should see the poll. I selected the "show poll results" when I created the poll. The poll and results are shown. Are you only wanting the results? If so, I 'll have to do a little more digging.
0
 

Author Comment

by:COwebmaster
Comment Utility
thanks for checking on that. Yes, I was able to get that far as well.  So, I have two polls on the site and based on the gender of the member who is signed in will display the specific poll (it's a dating site).

So if women log in, they see poll A and can vote, if men log in, they see poll B and can vote

What I need to do is now display the results of both polls on the site (in a sidebar text widget), the results of poll A and poll B.

I believe this is possible using the api but not sure how I can accomplish that using either xml or JSON from this page: http://support.polldaddy.com/api/
0
 
LVL 23

Accepted Solution

by:
jeremyjared74 earned 500 total points
Comment Utility
OK, that's a little outside the realm of the original question, but I'll try to help.

It appears to me the results are for displaying survey results. I've looked around and I've not been able to find a way to embed the results of Polls. It can be displayed by clicking the results button of the widget.

As for handling what content is displayed to which user, I'll look into the documentation, but it's probably best if handled by WordPress using a conditional statement.

Let me know your thoughts and I'll try to help out.

I've added the poll to a development site I'm using to work on a custom theme. You can view it here to see if this is what you mean (conditional view not included).
http://wordpressexpression.com/gallery
0
 

Author Comment

by:COwebmaster
Comment Utility
I have a similar poll but just need the results on any given poll to display without having to click on a results link.  There is an xml or JSON solution to pulling that data in which can be found on this page: http://support.polldaddy.com/api/

Thanks for your help with this.
0
 

Author Comment

by:COwebmaster
Comment Utility
Hi jeremyjared74.  Apparently, I have to use an api call to get my usercode.

Any luck with this?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
Hi Cowebmaster, sorry I've not checked back. I had an unexpected client pop-up with some pretty time consuming issues. I'm getting close to wrapping things up, but I'm working on very minimal sleep. It might be tomorrow before I can dedicate some time to the question.

regards,
jeremyjared74
0
 

Author Comment

by:COwebmaster
Comment Utility
okay thanks jeremyjared74.  Also, today I was informed that to get my usercode I need to make an api call using GetUserCode which can be found here using the method on this page: http://support.polldaddy.com/api/

0
 

Author Comment

by:COwebmaster
Comment Utility
Hi jeremyjared74.  Just checking in to see if you've found a solution on this yet.
0
 
LVL 23

Expert Comment

by:jeremyjared74
Comment Utility
It looks like it's going to take some work. I think I running into issues since I don't have a paid account. I was able to show the results, but it's not quite a dynamic solution.

You can go to the WordPress PollDaddy settings page, with the use of the WebDeveloper FF Plugin or by using FireBug, view the source, copy the html code for the results and use that to display them. That is a very bad solution I know.

I've been trying to get the results to display by copying the link you click to view the results and have is show up in a Thickbox Window. But I get a security warning.

The solution I've been working on is to view it via RSS. If you'll notice there is a RSS icon when you are in the PollDaddy results section. I've been able to show the results only when I subscribe to the RSS results via my e-mail program (Thunderbird).

I've got to do some work for someone so I'm going to have to put this on pause. I understand if you wish to close this out, but if you leave it open I'll try to come back to it later this evening.
0
 

Author Comment

by:COwebmaster
Comment Utility
Okay, no problem.  I totally understand.  I did find this page too... http://betterwp.net/87-add-polldaddy-polls-to-wordpress-using-api/comment-page-1/#comment-565
0
 

Author Comment

by:COwebmaster
Comment Utility
okay, using the above script on that site, I can do an api call to polldaddy and get a response.  I just need to figure out how to display just the results output, not the ability to vote.
0
 

Author Comment

by:COwebmaster
Comment Utility
Hi jeremyjared74.  Just checking in to see if you've had any success with getting just the results to pull back?
0
 

Author Closing Comment

by:COwebmaster
Comment Utility
I'm going to close this thread down and re-open another one.
0
 

Author Comment

by:COwebmaster
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now