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

This is kind of a long topic for the support desk, but I'll do my best.

The docs on tag extensions are pretty well documented, so I'll leave that to you. Needless to say, to make it as flexible as possible, it should probably take at least one parameter, category, and possibly some optional ones, "limit" to limit the number of articles shown, "format" to show either the whole article or a summary, etc.

Most of the information you want can be found via the API. It's a huge and flexible query system you can use to fetch information.

The best way to query it from an extension is to use the FauxRequest object. This allows you to query the API without making network calls. So it's fast. Or faster depending upon how many you make.

To get all the members of a category (up to the set limit), you can query as follows:

This queries the category API and returns the data in a PHP multi-dimensional array where  is the variable holding a category name like "Category: Foo".

Once you have the list of category members, you can then loop through them to get each page for which you query to get their content using a similar method. Once you have the content, you can then format and output it however you like. Personally, I prefer the "parse" method of the API since it turns all the wiki code into HTML and little formatting has to be done. That can be accomplished like so:

Where  is the name of the article you want to fetch content for.

Using this method, you should be able to access any page you want on your wiki and display the content based on the parameters passed via the tag extension.

Sounds like a pretty cool project.