Thread:Project:Support desk/How to display page content with an extension?/reply (5)

It looks like your main issue is that you don't have a return statement in your efSampleRender function. Without a return statement, the function will generate data, but not put any of it in the page. The other thing I notice is. That's only needed if you want to make a new api module. If you just plan to use an existing API moudle, you don't need a line like that.

Additionally, it was probably really bad advice on my part to suggest the parse api module. It didn't click in my head at the time, but that would call the parser recursively, which is a bad thing. (Basically, mediawiki can only parse one thing at a time, when your extension is running, its already parsing the current page, so it can't parse anything else, and calling api parse module would cause it to parse something else, which is bad (GoogleNewsSitemap extension didn't have that problem since it runs not while parsing another page). Generally what happens when the parser is called recursively is that mysterious markers like UNIQ3858f81c6798e00f-sample-00000009-QINU appear in the page. You can still use other api modules in your extension safely, just not the parse one (or any other module that involves parsing things)

Sine you just want to include a page, and are not interested in the actual html of the page, you might consider the $parser->recursiveTagParse method (Which does not count as calling the parser recursively). It takes wikitext and returns html (ish anyways). So you could just use normal template inclusion syntax. (Alternatively if you want to process the wikitext first, you could get the text from either the API, or something like, process the text, and stick it in recursiveTagParse)

For example, if you wanted to include a random page from some category (for example, if you wanted Foo return a random entry from category:Foo, your efSampleRender would look something like:

The database stuff can be a little complicated, especially when you are new to it, and in some ways it might be easier to use the API for that step. If your curious about the db stuff though, there's docs at Manual:Database access  and Manual:Categorylinks table ). If you're familiar with sql, the example query I gave above is equivalent to