Jump to content

Topic on Project:Support desk/Flow

Random - without link (novice)

7
DHFE (talkcontribs)

MediaWiki - 1.16.5 PHP - 5.2.6-2ubuntu4.3 MySQL - 5.0.67-0ubuntu6

I've been given the task of creating the intranet page for my department where I work. I'm a complete novice with mediawiki and everything i've created so far has been based off other entries people have made on our intranet but with some slight modifications as i've been learning as i've been going along. Given that it's the companies intranet, I don't have much say in downloads of extensions or modifications to the wiki which may be required to do what i'm looking to - which isn't too bad as i've got another idea i know i can do instead but won't look as good.

What i'm hoping to achieve is; I'm looking to create a category full of pages with information about my department then, I've created a template with two page frames, I would like a random page from this category to appear on one of those frames - so that each time the page is loaded a different random page appears in the frame without the need for the user to select the random page link

Is this possible to do without any extensions or modification? If so can you walk me through all the steps? - each time i've tried to look at how to create a category i keep getting pages that just tell me it's possible, but not how to do it - also i'd need to know everything about making the random page appear without the link.

Thanks for any help.

MarkAHershberger (talkcontribs)

Categories in MediaWiki are a lot like tags. All you do to categorize a page is add something like [[Category:Cats]] to the wikitext of a page. More information about this is on the help page.

To get a random page from your wiki, use javascript to make an api call to API:Random and use the first page from the list returned.

DHFE (talkcontribs)

Sorry, i just need to confirm - like i said i'm a complete novice so; If i enter something like [[Category:Cats]] anywhere in the wikitext of a page, it's added to that category? It doesn't need to be at the top, bottom, etc?

Also "To get a random page from your wiki, use javascript to make an api call to API:Random and use the first page from the list returned." seems like gibberish to me - I don't understand.

I need a little more help please.

MarkAHershberger (talkcontribs)

Yes, you can put it anywhere in the page's text.

I can't help you write javascript, but mayve if you can put a link to Special:RandomInCategory like this inside your frame.

81.150.209.81 (talkcontribs)

Thanks,

Is there any way to preselect the category from the RandomInCategoy? so that the users don't have to do it each time. I want this to automatically display a random page from a specific category whenever the page is loaded

MarkAHershberger (talkcontribs)

I think that would require circumventing the CSRF protection that is built into MediaWiki.

Ciencia Al Poder (talkcontribs)

As an alternative, you could use Extension:RandomSelection and transclude each article in the page, for example:

<choose>
<option>{{:Page to include 1}}</option>
<option>{{:Page to include 2}}</option>
<option>{{:Page to include 3}}</option>
</choose>

The drawback is that you will have to put each article of that category on the provided options.

Reply to "Random - without link (novice)"