Fandom

Community Central

Admin Forum:Get contents of a page without sidebars, header, etc

19,037pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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 1374 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 http://community.wikia.com/api.php?action=query&titles=Admin_Forum:Get_contents_of_a_page_without_sidebars,_header,_etc&rvprop=content&format=json

Then you can use a script to set things up:

userName = JSON.parse(
    $.ajax({
        url: wgServer + '/api.php',
        data: { action: 'query', format: 'json', rvprop: 'content', title: 'Template:Username' },
        async:false
    })
    .responseText
);
 
// 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). 96.240.94.47 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. http://community.wikia.com/wiki/Admin_Forum:Get_contents_of_a_page_without_sidebars,_header,_etc?action=render Matthew2602 Wall 01:28, July 13, 2012 (UTC)

Also on Fandom

Random Wiki