[MediaWiki-l] Categories + parser functions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] Categories + parser functions

Benny Lichtner
Sticking a category link in a wiki page automatically adds that wiki page
to the corresponding category page. For example, inserting
[[Category:Puppies]] adds the page to the Puppies category.

Is it possible to achieve the same result with something like
[[Category:{{#puppiesfunc}}]], where {{#puppiesfunc}} is replaced by
"Puppies"? I guess I'm wondering how the automatic population of category
pages works under the hood.

--Benny
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Categories + parser functions

Jeremy Baron
On Sun, Dec 23, 2012 at 11:19 PM, Benny Lichtner <[hidden email]> wrote:
> Sticking a category link in a wiki page automatically adds that wiki page
> to the corresponding category page. For example, inserting
> [[Category:Puppies]] adds the page to the Puppies category.
>
> Is it possible to achieve the same result with something like
> [[Category:{{#puppiesfunc}}]], where {{#puppiesfunc}} is replaced by
> "Puppies"? I guess I'm wondering how the automatic population of category
> pages works under the hood.

Can you state the actual problem you're trying to solve instead of the
way you want to solve it?

Anyway, maybe you're looking for addTrackingCategory()
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/parser/Parser.php;hb=c86a77bc4860b5fad2e70b473ef525844034b127#l4005

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Categories + parser functions

Benny Lichtner
On Mon, Dec 24, 2012 at 5:00 AM, <[hidden email]>wrote:

> On Sun, Dec 23, 2012 at 11:19 PM, Benny Lichtner <[hidden email]>
> wrote:
> > Sticking a category link in a wiki page automatically adds that wiki page
> > to the corresponding category page. For example, inserting
> > [[Category:Puppies]] adds the page to the Puppies category.
> >
> > Is it possible to achieve the same result with something like
> > [[Category:{{#puppiesfunc}}]], where {{#puppiesfunc}} is replaced by
> > "Puppies"? I guess I'm wondering how the automatic population of category
> > pages works under the hood.
>
> Can you state the actual problem you're trying to solve instead of the
> way you want to solve it?
>
> Good idea.


>  Anyway, maybe you're looking for addTrackingCategory()
>
> https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/parser/Parser.php;hb=c86a77bc4860b5fad2e70b473ef525844034b127#l4005
>

I'm creating pages that represent stores, and the format of every store
page is identical, so each store page transcludes the same store template
(which is used approximately like this: {{ store_template | storeID }}).
But stores belong to different categories depending on the kinds of goods
they sell. I have a parser function that, given the storeID, can fetch the
right good type from a database, so I want to use that function in the
store_template to categorize every store page dynamically.
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Categories + parser functions

nakohdo
> On Mon, Dec 24, 2012 at 5:00 AM, <[hidden email]>wrote:

> I'm creating pages that represent stores, and the format of every store
> page is identical, so each store page transcludes the same store template
> (which is used approximately like this: {{ store_template | storeID }}).
> But stores belong to different categories depending on the kinds of goods
> they sell. I have a parser function that, given the storeID, can fetch the
> right good type from a database, so I want to use that function in the
> store_template to categorize every store page dynamically.

You should have a look at Semantic MediaWiki http://semantic-mediawiki.org and perhaps get yourself a copy of http://workingwithmediawiki.com/

hth
Frank

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Categories + parser functions

Daniel Barrett-3
In reply to this post by Benny Lichtner
Jeremy Baron's idea about tracking categories is probably what you want. You can write a parser function that, instead of emitting strings (category names), actually DOES the categorizing for you. Here is his link again:

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/parser/Parser.php;hb=c86a77bc4860b5fad2e70b473ef525844034b127#l4005

DanB

-----Original Message-----
I'm creating pages that represent stores, and the format of every store page is identical, so each store page transcludes the same store template (which is used approximately like this: {{ store_template | storeID }}).
But stores belong to different categories depending on the kinds of goods they sell. I have a parser function that, given the storeID, can fetch the right good type from a database, so I want to use that function in the store_template to categorize every store page dynamically.

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l