Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: option to limit results only to a particular namespace #10

Open
shallimus opened this issue Mar 21, 2017 · 1 comment
Open

Comments

@shallimus
Copy link

shallimus commented Mar 21, 2017

I wanted to display only the top pages from a particular namespace (e.g. "procedures"), which I had expected to find as an available option in the top plugin, but perhaps not as many people want this feature as I imagine!

I managed to get this working by adding the following to syntax.php of the 2016-01-13 version:

47c47
<             $options = array('lang' => null, 'month' => null, 'tag' => 'ul', 'score' => 'false' );
---
>             $options = array('lang' => null, 'month' => null, 'tag' => 'ul', 'score' => 'false', 'namespace' => null);
94a95,98
>
>             // Hack support for 'only this namespace'
>             if ($data[1]['namespace'] !== null && strpos($item['page'], $data[1]['namespace']) === false) continue;
>

It's probably not ideal code, since if the argument to namespace is "procedures", this will also include pages from the namespace other:procedures and yet:more:procedures, but it's enough to be useful to me at the moment.

I regret that I am not in a position to submit this as a GitHub change - and as I mention above, I don't think it is good enough quality as it is - but hopefully this diff will be useful to someone.

@FosseWay
Copy link

I've proposed #12, which includes and extends this functionality so that a space-separated whitelist and blacklist may be specified as a parameter for each instance of top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants