Use MediaWiki auto-pagination outside of Category pages? - mediawiki

When I visit:
https://en.wikipedia.org/wiki/Category:1938_births
it shows me the first 200 pages in this category with a link to the next 200.
Can I use this magical auto-pagination on my regular pages somehow?
I'm using wikia.com and do not have shell access.

No, the category pagination code is its own class and can't be used anywhere else.
There is a reusable class for pagination which is TablePager, used e.g. in class ImageListPager extends TablePager; but that's for extension developers.

Related

Making one element for all pages?

I am just starting to learn HTML. I am trying to understand if it is possible to only have one element in the mainpage that can be use on every other pages instead of rewriting it onto every other single html file?
Thank you.
What you are talking about is called a component. A component is a reusable piece of small elements that you can use anywhere in your html. You can do it in two ways:
Server side: Make a function where you store that specific component.
Dynamic template: Use something like VueJS,ReactJS or AngulerJS to create and use a component where ever you like it. You can also use JS too. But I suggest VueJS,ReactJS or AngulerJS.

Set a custom title for all pages in MediaWiki?

I enabled the configuration variable "SubPages" in my MediaWiki.
Now I would like the following markup to be automatically placed on all pages.
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
In general, I want to customize my title pages.
Looks like mw.config has no access to subpage name, but in your custom JavaScript you could still use mediaWiki.message to parse a custom string like your {{DISPLAYTITLE:{{SUBPAGENAME}}}} and then replace it to the title and main h1.
This is a bit silly though, you could look into BookManager extension and other Wikisource/Wikibooks tricks to see how they handled subpages at scale.

Multiple views for 1 controller - Play Framework [duplicate]

If i want to have a common piece of UI across multiple pages, such as a menu, what is the recommended way to do this?
It would contain both template code and a back-end controller (similar to "snippets" in the LiftWeb framework).
I am aware that there is a menu module for Play, but I'm more interested in how this would be achieved in general.
There are two ways to include common view code into the Play Framework.
You can use the #{include} tag or the #{extends} tag.
The extends tag, as the name suggests, extends from a parent view. The extends tag is used by default in the skeleton code set up by Play when you create a new application. It extends the main.html. You add your code here.
The includes tag, allows you to inject a common piece of view code into your templates at a specified point. This works in much the same was a php include/require, or jsp includes work.
The problem will come when your template code also requires data or logic from the model (via the controller). If this is the case, then you will need to use the #Before or #With notation in your controller to ensure that the common piece of controller code is executed each time. You can add any data to the renderArgs list, so that it is available for use within the view.
A simple example of using renderArgs would be.
#Before
private static void commonData() {
// do your logic here
renderArgs.put("menu", menu);
renderArgs.put("selected", selectedMenuItem);
}
the values you have put into renderArgs (menu and selected in the example) will be available just in the same way as if you passed them into the render method.

Mediawiki 1.16: Template documentation example usage

I'm writing template documentation for a wiki and wanted to include a working example of the template. However, I wrote the template to auto-categorize various fields and the entire template itself is also auto-categorized.
This means if I simply call on the template, it will categorize the doc page...and because the actual template page transcludes the doc page, the template page will also be categorized.
Is there a way to prevent these categories from automatically kicking in?
Something like the following should do the trick. Wrap the categorization in your template inside a parserfunction:
{{#ifeq: {{NAMESPACE}} | Help || [[Category:Some_Category]] }}
This sets the category when the template is transcluded onto a page that is not in the "Help" namespace.
Another option is to allow a parameter such as demo to avoid including the category.
If you don't mind being slightly cryptic, you could do the category in the template as {{{cat|[[Category:Some_Category]]}}}; then specifying the parameter as {{my template|cat=}} will prevent the category inclusion.
I'm not sure if I understand the question completely (what is "auto-categorize various fields"?). I am assuming here that you want to show a template "in action" on a documentation page - without attaching some categories (those categories the documentation page usually attaches to articles using this template) to the documentation page.
So
<onlyinclude>[[Category:Some_Category]]</onlyinclude>
will not do the job - as the template is in fact included. Right?
Try passing a parameter categorize=false to the template to indicate that categories are not to be attached in this case:
{{#ifeq:{{{categorize|}}}|false||[[Category:Some_Category]]}}
The double pipe after "false" means: if(categorize==false) then (empty), else [[Category:Some_Category]] - i.e. it is an equivalent construction for if(NOT(categorize==false))...
Good luck and thanks for all the fish,
Achim

SalesForce.com Display image in S-Control

I need to display an image in an S-Control is SFDC. I would like to be able to reference a static resource like <apex:image url="{!$Resource.TestImage}" />, but that only works in VisualForce pages and I have to modify and existing S-Control (switching to VF is not an option).
What's the best way to accomplish this, so frustrated with the general lack of documentation and hackishness of SFDC development.
Thanks all
You can upload your image to Documents tab and later use normal <img> tag to display it on S-Controls, Visualforce pages and email templates (last one - if this will be an "externally available image"). The generated URL to view it will look somewhat like
https://c.na7.content.force.com/servlet/servlet.FileDownload?file=015A0000001IFxZ
(my test org sits at na7.salesforce.com instance and the last part is gnerated object's ID)