JavaScript Addition

By James KanjoJames Kanjo

Description

Sometimes, you may want to add up numerical data contained on your site. In such cases, you can use this special add-on to automatically add up the numerical data for you.

Code

Use the ListPages module to compile the list that contains numerical variables:

[[module ListPages perPage="250" separate="false" appendLine="[[include :snippets:code:_rdr |no-results=Sorry! There appears to be no results matching your specified criteria...]]"]]
[[embed]]<iframe frameborder="0" scrolling="no" style="background-color: transparent; width: 100%; height: 15px;" src="http://snippets.wdfiles.com/local--code/code:javascript-addition[!--

--]#NUMBER[!--

[[/module]]

In action

This code would be useful if you want to count the total number of revisions on your site:

**Total Number of Revisions:**
[[module ListPages category="*" pagetype="*" order="updated_at" perPage="250" separate="false" appendLine="[[include :snippets:code:_rdr |no-results=Sorry! There appears to be no results matching your specified criteria...]]"]]
[[embed]]<iframe frameborder="0" scrolling="no" style="background-color: transparent; width: 100%; height: 15px;" src="http://snippets.wdfiles.com/local--code/code:javascript-addition[!--
--]#%%revisions%%[!--
[[/module]]

Total Number of Revisions:

page 1 of 3123next »

Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by James Kanjo


Rate this solution

If you think this solution is useful — rate it up!

rating: +4+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License