[Home]WikiPatches/HtmlHeader

UseModWiki | WikiPatches | RecentChanges | Preferences

Similar to the /CSSskins patch, but without the user choice -- one HTML header file for the whole wiki.

59,89c56,58
< ######################### 
< # tarquin: extra config variables
< # path header file
< use vars qw($HTMLHeaderFile);
< # name of reference page & upload link
< use vars qw($ManPage $UploadLink);
< # for external files
< use vars qw($AncillaryDir $AncillaryUrl);
---
989,999c948,949
<   ############################
<   # tarq: external user-selected headers
<   # UseMod's original GetHtmlHeader is still required if config is set to "embed"
<   return $result . &GetHtmlHeader("$SiteName: $title") if ($embed);
<   
<   return $result . &GetUserFullHeader("$SiteName: $title", $id, $title, $oldId);
<   #$result .= &GetHtmlHeader("$SiteName: $title");
<   #return $result  if ($embed);
<   # tarq: this is where we optionally fetch the external header
<   #return $result . &GetExternalHeader($id, $title, $oldId) if ($UseExternalHeader);
<   # endtarq
---
>   $result .= &GetHtmlHeader("$SiteName: $title");
>   return $result  if ($embed);
---
> 
1067,1072c1007,1009
<   # tarq: user-selected stylesheet
<   #if ($StyleSheet ne '') {
<   #  $html .= qq(<LINK REL="stylesheet" HREF="$AncillaryUrl$StyleSheet">\n);
<   #}
<   #$html .= qq(<LINK REL="stylesheet" HREF="$AncillaryUrl$StyleSheetFile[&GetParam("stylesheet", 1)]">\n);
<   $html .= qq(<LINK REL="stylesheet" HREF="$AncillaryUrl$StyleSheet">\n);
---
>   if ($StyleSheet ne '') {
>     $html .= qq(<LINK REL="stylesheet" HREF="$StyleSheet">\n);
>   }
1084,1145d1021
< #########################################################
< # tarq: get full header specified by user
< sub GetUserFullHeader {
<   my ( $windowtitle, $id, $title, $oldId) = @_;
<   # we've been passed: ("$SiteName: $title", $id, $title, $oldId)
< 
<   my ( $header, $main , $sub , $complextitle, @quips , $randomquip );
<   # may as well use existing opening function.
<   $header = &ReadFileOrDie($HTMLHeaderFile);
<   
<   $header =~ s/%windowtitle%/$windowtitle/eg;  
<   $header =~ s/%contentstyles%/$AncillaryUrl . $StyleSheet/eg;   
<   
<   #simple version: $header =~ s/%title%/$title/g; 
<   if ($id =~ m|/|) {
<     # we are dealing with a subpage
<     $main = $sub = $id;
<     $main =~ s|/.*||;  # Only the main page name (remove subpage)
<     $sub  =~ s|\w*/|| ;
<     # mych if you spot this: why won't the next line work?
<     #$header =~ s/%title%/&GetPageLink($main) . "/" . &GetSearchLink($id)/eg; 
<     $complextitle = &GetPageLink($main) . " / " . &GetSearchLink($sub) ;
<     $header =~ s/%title%/$complextitle/eg; 
<     # note that GetSearchLink handles trimming the sub from the main.
<   } else {
<     # we're not
<     $header =~ s/%title%/&GetSearchLink($title)/eg; 
<     #$header =~ s/%title%/blickle/g; 
<   }
<   $header =~ s/%url%/$AncillaryUrl/eg;   
<   $header =~ s/%path%/$AncillaryDir/eg;   
<   $header =~ s/%logo%/$AncillaryUrl$LogoUrl/g;   
<   # links:
<   $header =~ s/%home%/&GetPageLink($HomePage)/eg;   
<   $header =~ s/%prefs%/&GetPrefsLink()/eg;
<   $header =~ s/%random%/&GetRandomLink()/eg;
<   $header =~ s/%recent%/&GetPageLink($RCName)/eg;
<   $header =~ s/%ref%/&GetPageLink($ManPage)/eg;
<   # handle | links too
<   $header =~ s/%page%(\S+)\|(\S+)%/&GetPageOrEditLink($1, $2)/eg;
<   $header =~ s/%page%(\S+)%/&GetPageOrEditLink($1)/eg;
<   
<   $header =~ s/%upload%/$UploadLink/g;
<   
<   # ========== quip
<   if( $header =~ m/%quip%/ ) {
<     open QUIPS, $AncillaryDir . 'quips.txt';
<     #open QUIPS, &GetPageFile($1);
<     @quips = <QUIPS>;
<     close QUIPS; 
<     $randomquip = $quips[rand @quips];
< 
<     $header =~ s/%quip%/$randomquip/eg;
<   }
<   # ========== endquip
< # for mysterious reasons it won't work without this line  
< $header .= " ";
< 
< }
< # end tarq
< ###################################
< 

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited June 9, 2002 3:32 pm by Tarquin (diff)
Search: