Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can try 'cheating' your way there by adding a token which does (almost) "nothing".</p> <p>For example let's create a token <code>{alert-date}</code>.</p> <pre><code>$("#events-output").rss("http://feeds.feedburner.com/google/lkRN", { limit: 4, tokens: { 'alert-date': function (entry, tokens) { alert(tokens.date); return ''; }, }, layoutTemplate: '&lt;span id="entries"&gt;{entries}&lt;/span&gt;', entryTemplate: '{date} &lt;a href="{url}"&gt;{title}&lt;/a&gt;&lt;br&gt;{alert-date}' }).show(); </code></pre> <p>This way you create a function which generates the token contents each time a row is generated. You return empty string, so the token dissapears from the output contents, but the code from the function is actually ran. You can put the token anywhere in your template - it will be empty anyway always. Remember that instead of alerting the contents of <code>tokens.date</code> variable you can store them somewhere for later use.</p> <p>Please run <code>console.log(tokens)</code> inside your token function - you can see all the tokens' contents and you don't need to parse html like someone else proposed.</p> <p>Look at fiddle: <a href="http://jsfiddle.net/w6zAf/" rel="nofollow">http://jsfiddle.net/w6zAf/</a></p> <hr> <p><strong>How to get more info from the date?</strong> </p> <p>You can generate date from your XML. It's easy in javascript as it does all the work for you. Instead of writing <code>alert(tokens.date)</code> in the code above you can generate new object date which is done this way:</p> <pre><code>var date = new Date(tokens.date); var month = date.getMonth(); </code></pre> <p>More here: <a href="http://www.w3schools.com/jsref/jsref_obj_date.asp" rel="nofollow">http://www.w3schools.com/jsref/jsref_obj_date.asp</a></p> <hr> <p><strong>Create token month and day</strong></p> <pre><code>$("#events-output").rss("http://feeds.feedburner.com/google/lkRN", { limit: 4, tokens: { 'month': function (entry, tokens) { var date = new Date(tokens.date); return date.getMonth(); }, 'day': function (entry, tokens) { var date = new Date(tokens.date); return date.getDay(); }, }, layoutTemplate: '&lt;span id="entries"&gt;{entries}&lt;/span&gt;', entryTemplate: '{date} &lt;a href="{url}"&gt;{title}&lt;/a&gt;&lt;br&gt;' }).show(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload