Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Broadcasting DZONE Shares (See related posts)

// This snippet will allow you to show your DZONE shares
// on your web page. Visit your shares page, click on the "feed" link
// to get the URL of your personal shares feed then paste it in the first line
// in the script.

var sharedURL='';  // Place your url between the quotes.

function getFeed(url, callback) {
   var newScript = document.createElement('script');
       newScript.type = 'text/javascript';
       newScript.src = 'http://pipes.yahoo.com/pipes/9oyONQzA2xGOkM4FqGIyXQ/run?&_render=JSON&_callback='+callback+'&feed=' + sharedURL;
   document.getElementsByTagName("head")[0].appendChild(newScript);
}

function dzone(feed) {
   var tmp='';
   for (var i=0; i<feed.value.items.length; i++) {
      tmp+='<a href="'+feed.value.items[i].link+'" rel="nofollow">';
      tmp+=feed.value.items[i].title+'</a><br>';
   }
   document.getElementById('dzoneLinks').innerHTML=tmp;
}

getFeed(sharedURL, 'dzone');


// Paste that code at the end of your page. In your HTML place the following two divisions
// where you would like your feed to appear. (feel free to style the divisions however you wish)
// you can add to/subtract from the outer division but the inner division will always be overwritten
// with your shares.

<div id='dzoneLayer'>
My DZONE Recommendations
   <div id='dzoneLinks'>
   </div>
</div>


You need to create an account or log in to post comments to this site.


Click here to browse all 4858 code snippets

Related Posts