2008-07-10

JavaScript : Recent posts/articles using JSON

One of the obvious JSON advantages is that it can be directly evaluated in JavaScript. JSON (Java Script Object Notation) is another data exchangeable format like XML, but it is more lightweight,easily readable and fast data transfered/loaded. It is based on a subset of Javascript language. Therefore, Javascript can understand JSON. To sump it all, it is much better than using RSS feed for your recent posts. This guide will explain how it can be done.

Login to your Dashboard> Layout> Edit Html. Place this code right between the closing b:skin tag and the closing head tag.


Click here to copy the code.


Save the settings and click on Page Elements. Choose to add Html/Javascript, and place the below code into it.
<script src="/feeds/posts/default?orderby=published&amp;alt=json-in-script&amp;callback=rp"></script>

Click here to copy.


Note - You may change the number of recent posts to a maximum of 25. Also, the number of characters to any value as you wish.

6 comments:

Sweet said...

Do you use frames?
I mean, navigation between your posts is quite easy and fast.
How can I reach the same result?

it's really important to me because my blog is very heavy.. :(

Is said...

To answer you, მარი. I'm using AJAX to fetch the content. The content can be just text, or it can contain text-level (inline frame) markup, or even block-level markup. By using AJAX, it will speed up a web page load time :)

Sweet said...

and do you have any tutorial written about it, or should I find out what is and how I use AJAX by myself? :D

Is said...

@მარი, Down at the bottom of my footer, you'll see this template is powered by NEO. It's an AJAX-driven fast template with which one can read through the posts in a blog quickly. I've benefited from Ramani's hack and improvise his hack to suit my preferences. More details can be found at http://hackosphere.blogspot.com/2006/12/now-available-neo-template.html
To me, he's one of the masters (the rest are Stephen, Hoctro, Anhvo, Phydeaux, Hans, PurpleMoogy and Aditaya). Without them, Blogger is just real crap :P

Sweet said...

Oh, thank you thank you thank you!

I am trying to convert neo to my own design.
if its possible...

I answered your comment at my blog ^_^


p.s. My name is Mari. :)

Sweet said...

Is, can you skype me?
isabelwolff

Post a Comment

1. Comments posted must be accompanied by names or pseudonyms.
2. Anonymous posting and those containing profanities will be rejected.
3. Comments are moderated due to spam problems. I have to approve the comment before it will show up.

:)) ;)) ;;) :D ;) :p :(( :) :( :X
=(( :-o :-/ :-* :| 8-} :)] :-t b-( :-L