[Home]WikiPatches/ImprovedLogoInsert

UseModWiki | WikiPatches | RecentChanges | Preferences

Options for inserting logo offers two positions (right or left) in configure file but it doesn't give a similar result in regard to vertical adjustement.

See the current one in action:

Moreover you can not align center.

The Pacht 1

div (wiki)logo nested with wikibody

In GetHeader subroutine:

sub GetHeader {
...
  if ((!$embed) && ($LogoUrl ne "")) {
    $logoImage = "img src=\"$LogoUrl\" alt=\"$altText\" border=0";
    + if (!$LogoLeft) {
      + $result .="<div align='right'>";
    + }
    + if ($LogoLeft eq 1) {
      + $result .="<div align='left'>";
    + }
    + if ($LogoLeft eq 2) {
      + $result .="<div align='center'>";
    + }
    - $header = &ScriptLink($HomePage, "<$logoImage>");
    + $result  .= &ScriptLink($HomePage, "<$logoImage>");
    + $result  .= '</div>'; 
  }
  if ($id and $backlinks) {
    - $result .= $q->h1($header . &GetBackLinksSearchLink($id));
    + $result .= $q->h1(&GetBackLinksSearchLink($id));
  } else {
    - $result .= $q->h1($header . $title);
    + $result .= $q->h1($title);
  }
  if (&GetParam("toplinkbar", 1)) {
    $result .= &GetGotoBar($id) . "<hr class=wikilineheader>";
...
}
Now, you can see that the logo link is out of H1 tags too (it's not a title after all).

The Pacht 2

Wikilogo and wikibody are independent.
sub GetHeader {
...
  return $result  if ($embed);

  - $result .= '<div class=wikiheader>';
  + if ((!$embed) && ($LogoUrl ne "")) {
    + $logoImage = "img src=\"$LogoUrl\" alt=\"$altText\" border=0";
    + if (!$LogoLeft) {
      + $result .="<div class=logo align=right>";
    + }
    + if ($LogoLeft eq 1) {
      +$result .="<div class=logo align=left>";
    +}
    if ($LogoLeft eq 2) {
      + $result .="<div class=logo align=center>";
    + }
  $result  .= &ScriptLink($HomePage, "<$logoImage>");
  $result  .= '</div>';  
  }
  + $result .= '<div class=wikiheader>';
  if ($oldId ne '') {
    $result .= $q->h3('(' . Ts('redirected from %s', 
Then in your CSS file, you can always add:
div.logo {
}

In Configure file, this was changed:

# Minor options:
- $LogoLeft     = 0;      # 1 = logo on left,       0 = logo on right
+ $LogoLeft     = 0;      # 2 = logo on center,     # 1 = logo on left,       0 = logo on right

In CSS, It was added some adjustment completely optional:

div + h1 {
margin:0px;
}

See in action

I prefer the second one. --JuanmaMP

The Patch 3

Completion of the above, this mode 3 permits text around logo, at top, right, bottom or left in relative position on the logo, for all them interested about design on header.
# Other global variables:
+  $LogoText $LogoTextPosition $LogoPosition
sub GetHeader {
...
if ((!$embed) && ($LogoUrl ne "")) {
    + $logoImage = "img class=wikilogo src=\"$LogoUrl\" style=\"vertical-align:middle\"
    + alt=\"$altText\" border=0";
    + if ($LogoPosition eq 0) {
      + $result .='<div class=wikilogo align=left>';
    + } 
    + if ($LogoPosition eq 1) {
      + $result .='<div class=wikilogo align=center>'; 
    + } 
    + if ($LogoPosition eq 2) {
      + $result .='<div class=wikilogo align=right>'; 
    + } 
    + if ($LogoTextPosition eq 0) {
      + $result  .= '<span class=wikilogo style="vertical-align:middle">'
      + . &ScriptLink($HomePage, $LogoText) . '</span>'  . '<br>'
      + . &ScriptLink($HomePage, "<$logoImage>"); 
    + } 
    + if ($LogoTextPosition eq 1) {
      + $result  .= &ScriptLink($HomePage, "<$logoImage>") 
      + . '<span class=wikilogo style="vertical-align:middle">' 
      + . &ScriptLink($HomePage, $LogoText) . '</span>'; 
    + }
    + if ($LogoTextPosition eq 2) {
      + $result  .= &ScriptLink($HomePage, "<$logoImage>") . '<br>' 
      + . '<span class=wikilogo style="vertical-align:middle">'
      + . &ScriptLink($HomePage, $LogoText) . '</span>'; 
    + }
    + if ($LogoTextPosition eq 3) {
    + $result  .= '<span class=wikilogo style="vertical-align:middle">'
    + . &ScriptLink($HomePage, $LogoText) . '</span>' 
    + . &ScriptLink($HomePage, "<$logoImage>"); 
    + }
  + }
In Config file:
# Minor options:
- $LogoLeft     = 0;      # 1 = logo on left,       0 = logo on right
+ $LogoPosition   = 0;      # 0 = logo on left, 1 = logo on center, 2 = logo on right
+ $LogoTextPosition = 1;    # 0 = text on top, 1 = text on right, 2 = text on bottom, 3 = text on left
+ $LogoText = '';           # Title for logo

To Do


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 29, 2009 2:01 pm by JuanmaMP (diff)
Search: