Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

display xml in wordpress page

Posted on 2011-09-20
18
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 6
18 Comments
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36570602
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
ID: 36570625
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
ID: 36570635
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:COwebmaster
ID: 36570659
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
ID: 36570769
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
ID: 36570795
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 2000 total points
ID: 36571016
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
ID: 36571158
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
ID: 36574076
Hi jeremyjared74.  Apparently, I have to use an api call to get my usercode.

Any luck with this?
0
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36576793
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
ID: 36576827
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
ID: 36581786
Hi jeremyjared74.  Just checking in to see if you've found a solution on this yet.
0
 
LVL 23

Expert Comment

by:jeremyjared74
ID: 36582056
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
ID: 36582121
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
ID: 36582719
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
ID: 36587596
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
ID: 36588317
I'm going to close this thread down and re-open another one.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

730 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