Wir empfehlen:


Banner für Sidebar

Aus DadAWeb
Version vom 28. Oktober 2009, 17:38 Uhr von WikiSysop (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „===Add a banner to the sidebar (PHP)=== You can add one or more banners to the sidebar by hacking your ''skins/Monobook.php'' file (if you're using monobook) to i…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Add a banner to the sidebar (PHP)

You can add one or more banners to the sidebar by hacking your skins/Monobook.php file (if you're using monobook) to include the following piece of code.

Find (line 188):

?>
		</div><!-- end of the left (by default at least) column -->

Include:

?>
	<!-- begin of banner1 -->
	<div class='generated-sidebar portlet'>
	<h5><?php $this->msg('sidebar-banner1-headingtext') ?></h5>
	<div style="border: 1px solid #B0B0B0; background-color: #FFFFFF;">
	<a href="<?php $this->msg('sidebar-banner1-url') ?>">
	<img width="100%" title="<?php $this->msg('sidebar-banner1-alttext') ?>" 
		alt="<?php $this->msg('sidebar-banner1-alttext') ?>" 
		src="<?php $this->msg('sidebar-banner1-imgsrc') ?>" /></a>
	</div></div>
	<!-- end of banner1 -->
		</div><!-- end of the left (by default at least) column -->

Now in your Wiki, create four System messages: (i.e. articles named MediaWiki:sidebar-banner1-...)

parameter value
sidebar-banner1-headingtext The text that will be displayed as the banner heading ("advertisement", "sponsor" etc.)
sidebar-banner1-url The destination URL of this banner
sidebar-banner1-alttext Content of the alt="" parameter of an HTML <img> tag: any title for the destination site
sidebar-banner1-imgsrc Content of the src="" parameter of an HTML <img> tag: the URL of the banner image. It may be the address of an image uploaded to your Wiki (magic words may be used, e.g. {{filepath:banner1.png}}), or the address of an external image

To add more banners, just repeat the process renaming "banner1" to "banner2" etc.