This Forum has been archived

Forums: Admin Central Index General Questions Get contents of a page without sidebars, header, etc
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1776 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Is there possibly a way to get the content of a page without sidebars, ads, and things? (Example on another website - main page and content page). I'm making a game and I want to have the game read the username (via the Username template). Iggyvolz 17:36, July 5, 2012 (UTC)

You can use the MediaWiki API for this: See this page for example,_header,_etc&rvprop=content&format=json

Then you can use a script to set things up:

userName = JSON.parse(
        url: wgServer + '/api.php',
        data: { action: 'query', format: 'json', rvprop: 'content', title: 'Template:Username' },
// do stuff with the variable

 TK999 17:44, July 5, 2012 (UTC)

Do I put that script on the page, or in my game? (I use ActionScript 3 via Stencyl). 18:55, July 5, 2012 (UTC)

If you just need the plain html of a page, you can add ?action=render to the url eg.,_header,_etc?action=render Matthew2602 Wall 01:28, July 13, 2012 (UTC)