[Home]WikiPatches/MultiCSS

UseModWiki | WikiPatches | RecentChanges | Preferences

This patch allows to specify multiple stylesheets in an array that is map()ped to link-tags.

I have written a patch that allows users to choose from several headers & CSS stylesheets on the preferences page. It's running at UnrealWiki; see WikiPatches/CSSskins for the code -- Tarquin

--- wiki.pl     Sun Apr 22 02:44:10 2001
+++ wiki.pl.new Thu Feb 14 03:22:15 2002
@@ -43,7 +43,7 @@
   $FreeLinks $WikiLinks $AdminDelete $FreeLinkPattern $RCName $RunCGI
   $ShowEdits $ThinLine $LinkPattern $InterLinkPattern $InterSitePattern
   $UrlProtocols $UrlPattern $ImageExtensions $RFCPattern $ISBNPattern
-  $FS $FS1 $FS2 $FS3 $CookieName $SiteBase $StyleSheet $NotFoundPg
+  $FS $FS1 $FS2 $FS3 $CookieName $SiteBase @StyleSheets $NotFoundPg
   $FooterNote $EditNote $MaxPost $NewText $NotifyDefault $HttpCharset
   $UserGotoBar);
 # Note: $NotifyDefault is kept because it was a config variable in 0.90
@@ -74,7 +74,7 @@
 $RedirType   = 1;               # 1 = CGI.pm, 2 = script, 3 = no redirect
 $AdminPass   = "";              # Set to non-blank to enable password(s)
 $EditPass    = "";              # Like AdminPass, but for editing only
-$StyleSheet  = "";              # URL for CSS stylesheet (like "/wiki.css")
+@StyleSheets  = ();             # URLs for CSS stylesheets (like ("global.css","/wiki.css"))
 $NotFoundPg  = "";              # Page for not-found links ("" for blank pg)
 $EmailFrom   = "Wiki";          # Text for "From: " field of email notes.
 $SendMail    = "/usr/sbin/sendmail";  # Full path to sendmail executable
@@ -1004,8 +1004,10 @@
   if ($SiteBase ne "") {
     $html .= qq(<BASE HREF="$SiteBase">\n);
   }
-  if ($StyleSheet ne '') {
-    $html .= qq(<LINK REL="stylesheet" HREF="$StyleSheet">\n);
+  if (@StyleSheets) {
+    $html .= join("\n", map {
+                             $q->Link({-rel=>"stylesheet", -href=>$_})
+                            } @StyleSheets );
   }
   # Insert other header stuff here (like inline style sheets?)
   $bodyExtra = '';

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 2, 2007 6:38 pm by MarkusLude (diff)
Search: