Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Joe Bruno
Joe Bruno
35,909 Points

jQuery: Coding Efficiently Help

Hello,

I am using this jquery plugin to pull content from an rss feed into my site: https://github.com/sdepold/jquery-rss. Works great. No issues there. However, I would like to have more than one of these little widgets on my site. I don't want to replicate the full code every time when the only thing that is changing is the url. All other options will remain as they are. I have tried to modify the origin plugin file, but cannot seem to over ride the default formats. Any help would be greatly appreciated.

  <script>
  var j=jQuery.noConflict();
    j(document).ready(function() { 
      jQuery(function($) {
        j(".allFeeds")
            .rss("http://feeds.feedburner.com/patheos/Ukoy", {
              limit: 3,
             layoutTemplate: '<div class="destroy"></div>',
             entryTemplate: '<li class="view mix span4" data-name="{title}" data-age="{date}"><div  class="view-back"><a class="feedLink" href="#"><img src="/assets/greenarrow.png"/><div class="feedBody hidden">{body}{url}</div></a></div><div class="front"><div class="date">{prettyDate}</div><div class="title">{title}</div></div></li>',
             tokens: {
                prettyDate: function(entry, tokens) {
                return moment(tokens.date).format("DD <br> ddd")
                          }
                      }
                    });
                  });
                });

</script>

1 Answer