[moin-user] Theme for subpages

Christoph Klassen christoph.klassen at intevation.de
Fri Aug 5 06:29:40 EDT 2022


Hello again,

Am 02.08.22 um 13:50 schrieb Christoph Klassen:
> with the help of the wiki I found out how to create a custom theme. But 
> I would like to set another theme for specific subpages. Let's say - as 
> an example - every page should be displayed with the theme "default" but 
> pages whose path begins with "/sub-topic" should be displayed with the 
> theme "extraordinary".
> 
> Is that possible with MoinMoin 1.9? If yes, how could I do that or where 
> should I start?
I don't know how to change the theme depending on the url yet but at 
least I know how to change the logo depending on the url.

Here is how I did it (in the function logo() in the python file of the 
theme):
request = self.request
page = request.themedict['page']
page_name = page.page_name
logo = 'default.png'
category=page_name.split('/')[0]
if category == 'sub_topic':
     logo = 'subtopic.png'

And then insert the logo in the header.

Before I didn't know that the function logo() was called every time I 
open a new page (if it's not already in the cache).


Greetings,
Christoph

-- 
Christoph Klassen  |  https://www.intevation.de/
Intevation GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 18998
Geschäftsführer: Frank Koormann, Bernhard Reiter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <https://mail.python.org/pipermail/moin-user/attachments/20220805/c218093f/attachment.sig>


More information about the moin-user mailing list