Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to show last 10 topics on other webpages (only some categories.)

edited November 2011 in Vanilla 2.0 - 2.8

I want to show last 10 topics but separate the category.
(showing only one category at a time)

look at my code , what shall I do next ?

on http://ebay.fakjai.com/bbs/top20.php

<script src="jquery.js"></script>
<script>
// Include this script where you want to embed the latest 10 discussions.
// This script requires jQuery.

document.write('<div id="vn_discussions_popular"></div>');

jQuery(document).ready(function($) {
   var url = 'http://ebay.fakjai.com/bbs/discussions.json?page=1-10&callback=?';

   $.ajax({
     url: url,
     dataType: 'json',
     success: function(data) {
         var foo = 'bar';
         var result = '';

         for(i in data.Discussions) {
            d = data.Discussions[i];
            result += '<img src="http://ebay.fakjai.com/wp-content/themes/fakjai/images/PostBullets.png">&nbsp; <a href="'+d.Url+'">'+d.Name+'</a>&nbsp; โดย '+d.FirstName+'&nbsp; ( '+d.CountViews+' เข้าชม &nbsp;'+d.CountComments+' ความคิดเห็น  )  </img><br />';
         }

         result = '<ul>'+result+'</ul>';
         $('#vn_discussions_popular').html(result);
      }
   });
});
</script>

Best Answer

  • ToddTodd Vanilla Staff
    Answer ✓

    The post that I originally helped you had the answer in the notes.

    Notice that the url looks very similar to the url that you browse to when viewing the forum normally. The only difference is that it has a .json?page=1-20&callback=? on the end. This is the API in action and you can call most urls that way.

Answers

  • ToddTodd Vanilla Staff
    Answer ✓

    The post that I originally helped you had the answer in the notes.

    Notice that the url looks very similar to the url that you browse to when viewing the forum normally. The only difference is that it has a .json?page=1-20&callback=? on the end. This is the API in action and you can call most urls that way.

  • I get it , Thanks so much .

Sign In or Register to comment.