views:

157

answers:

2

Hello,

For my wishlist site, I would like to propose widgets to my users in order to publish their wishlist on their blog or personal website. The idea is to propose a few lines of code to my users that they only need to copy/paste to insert the widget displaying their wishlist.

What is the best way to create/develop a widget ?

  • I have a RSS feed for each wishlist
  • Since the code need to be dynamic, I prefer not to use service like WidgetBox
  • Flash ? iFrame ?
  • Possibility to use jQuery

Thanks for your input...

+3  A: 

Definitely not flash [throws up]

What about using JavaScript? I am reminded of the Twitter Lists Widget that uses a bit of JavaScript to return the data and paint the HTML on the screen.

This is how Twitter does it:

<script src="http://widgets.twimg.com/j/2/widget.js"&gt;&lt;/script&gt;
<script>
new TWTR.Widget({
  version: 2,
  type: 'list',
  rpp: 30,
  interval: 6000,
  title: 'Everything we do at',
  subject: 'the twoffice',
  width: 250,
  height: 300,
  theme: {
    shell: {
      background: '#ff96e7',
      color: '#ffffff'
    },
    tweets: {
      background: '#ffffff',
      color: '#444444',
      links: '#b740c2'
    }
  },
  features: {
    scrollbar: true,
    loop: false,
    live: true,
    hashtags: true,
    timestamp: true,
    avatars: true,
    behavior: 'all'
  }
}).render().setList('ilmv', 'web-geeks').start();
</script>

Obviously you may not need to use as many options, but a username field would certainly be helpful. It would be very easy to generate your users code, and you might even be able to make use of your RSS feed for this.

ILMV
+1  A: 

No reason not to use Flash, depending on what exactly you want to do. There are more or less universally accepted embed codes (see youtube's, for instance) that will allow a user to copy-and-paste the widget into their own website, pulling content from your server. You will retain control over the content of the widget, too, so if you want to re-style it or make a copy change then you can do that on your end and be confident that no matter where it's embedded the change will take effect.

AS3 is very powerful and allows you to do basically anything you want. The one trade-off here is that Flash doesn't display on iPhones as of right now. That will probably change in the future, but probably not in the immediate future.

If you're using RSS to manage the data you're in luck because Flash's native E4X parser will let you work with that data easily and use it as a model for whatever you want to build. If I were doing something like this I'd use Flash without a second thought, but in fairness I am a professional AS3 developer.

Myk
It's all well and good saying YouTube has it's own Flash embed code, but that's for a video sharing site. I would like to know an example of a non-media widget that uses flash and is better than a code based alternative.
ILMV
What do you mean code-based? .swf files are compiled AS3 and if the developer has any chops at all it's written using OOP best practices with custom classes and events, separation of concerns, polymorphism enabling easy future updates etc. I appreciate that JS is code too, but I can't help but feel like you're spewing hostility at something you don't quite understand. What's the benefit? Isn't the point to learn as much as we can about all of the tools at our disposal?
Myk