Wikinews:Custom skin/Latest code

From Wikinews, the free news source you can write!
Jump to: navigation, search

This page contains the most recent code from the Wikinews skin currently entered in the Wikinews design contest. Please note that much of the code is still not optimized and contains a lot of unneeded content. The skin is currently done with tables (not CSS, which I am working to revise it into) as the images were originally exported from Photoshop. —The preceding unsigned comment was added by noclip (talkcontribs)

I have tried to update this somewhat as noclips version didn't work for me. Unfortunatly i never actually saw what his final product looked like, so it might be slightly(or a lot) different. The original is available in the history. please note there are still issues needing to be worked out with this. All paths are relative to wherever you installed mediawiki (perhaps /var/www/w, or something along those lines) Bawolff 02:39, 20 January 2008 (UTC)

in skins/WikiNews.php

<?php
//This page contains the most recent code from the Wikinews skin currently entered in the Wikinews design contest. Please note that much of the code is still not optimized and contains a lot of unneeded content. The skin is currently done with tables (not CSS, which I am working to revise it into) as the images were originally exported from Photoshop.
 
//<code><small><nowiki>
 
// "Wikinews" skin by Noclip
// Revision 3.14-modified
// Modified by bawolff
if( !defined( 'MEDIAWIKI' ) )
	die();
 
//require_once('includes/SkinTemplate.php');
 
class SkinWikiNews extends SkinTemplate {
	function initPage( &$out ) {
		SkinTemplate::initPage( $out );
		$this->skinname  = 'wikinews';
		$this->stylename = 'wikinews';
		$this->template  = 'WikiNewsTemplate';
	}
}
 
class WikiNewsTemplate extends QuickTemplate {
	function execute() {
?><?php $inWikinews = 'true'; //Will eventually check whether or not the skin is being used at Wikinews.org and disable the Category bar if not ?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<title><?php $this->text('pagetitle') ?></title>
<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css"; /*]]>*/</style>
<link rel="stylesheet" type="text/css" media="print" href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css" />
<script type="text/javascript" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
<!--[if IE]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE.css";</style>
<![endif]-->
 
<!--[if gte IE 5.5000]><script type="text/javascript" src="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE56PNG.js"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<?php if($this->data['jsvarurl'  ]) { ?><script type="text/javascript" src="<?php $this->text('jsvarurl'  ) ?>"></script><?php } ?>
<script type="text/javascript" src="<?php                                   $this->text('stylepath' ) ?>/common/wikibits.js"></script>
<?php if($this->data['usercss'   ]) { ?><style type="text/css"><?php              $this->html('usercss'   ) ?></style><?php    } ?>
<?php if($this->data['userjs'    ]) { ?><script type="text/javascript" src="<?php $this->text('userjs'    ) ?>"></script><?php } ?>
<?php if($this->data['userjsprev']) { ?><script type="text/javascript"><?php      $this->html('userjsprev') ?></script><?php   } ?>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 RIGHTMARGIN=0 TOPMARGIN=0 BOTTOMMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
 
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=8 class="filler" height="10"></TD>
</TR>
<TR>
<TD COLSPAN=3 class="filler" id="topfiller">
&nbsp;</TD>
<TD COLSPAN=4 class="topbar" id="search"><div id="sbody">
<form name="searchform" action="<?php $this->text('searchaction') ?>" id="searchform">
<input id="sinput" name="search" type="text" <?php if($this->haveMsg('accesskey-search')) { ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php } if( isset( $this->data['search'] ) ) { ?> value="<?php $this->text('search') ?>"<?php } ?> />
<input type='submit' name="fulltext" id="sbutton" value="<?php $this->msg('search') ?>" /></div>
</TD></form>
 
<TD ROWSPAN=2 class="filler" width="100%">
&nbsp;</TD>
</TR>
<TR>
<TD COLSPAN=7 BGCOLOR=#666666 class="topbar" id="navigation">
<div id="topbartext">
<?php  foreach($this->data['nav_urls'] as $navlinktext => $navlink) { ?>
<a href="<?php echo htmlspecialchars($navlink['href']) ?>"><?php
 
if (!empty($navlink['text'])) {
	echo htmlspecialchars($navlink['text']);
}
else {
	echo $navlinktext;
} ?></a>&nbsp;&nbsp;<?php }  ?>
</div></TD>
</TR>
<TR>
<TD colspan="8" width="100%" id="logo">
<a href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" title="<?php $this->msg('mainpage') ?>"><img class="borderless" id="mainlogo" src="<?php $this->text('logopath') ?>"></a>
</TD>
</TR>
<?php if($inWikinews == true) { ?><div id=""><TR>
<TD COLSPAN=2 id="topics">
 
<table align="center" border="0" width="100%" cellpadding="5" height="100%" cellspacing="0">
<tr><td><div id="topicstext">
<li><a href="Crime_and_law">Crime and law</a></li>
<li><a href="Culture_and_entertainment">Culture and entertainment</a></li>
<li><a href="Disasters_and_accidents">Disasters and accidents</a></li>
<li><a href="Economy_and_business">Economy and business</a></li>
<li><a href="Environment">Environment</a></li>
</div></td><td align="right"><div id="topicstext">
<li><a href="Health">Health</a></li>
<li><a href="Obituaries">Obituaries</a></li>
 
<li><a href="Politics_and_conflics">Politics and conflicts</a></li>
<li><a href="Science_and_technology">Science and technology</a></li>
<li><a href="Sports">Sports</a></li>
<li><a href="Wackynews">Wackynews</a></li>
</div></td></tr></table>
</TD>
<TD COLSPAN=3 id="regions"><div id="regionstext">
<li><a href="Africa">Africa</a></li>
<li><a href="Asia">Asia</a></li>
<li><a href="Central_America">Central America</a></li>
 
<li><a href="Europe">Europe</a></li>
<li><a href="Middle_East">Middle East</a></li>
<li><a href="North_America">North America</a></li>
<li><a href="Oceania">Oceania</a></li>
<li><a href="South_America">South America</a></li></div></TD>
<TD id="regionsfiller">
&nbsp;</TD>
<TD HEIGHT=100 COLSPAN=2 class="sidebar"><div class="sidebartext">
Latest news<br>
Get involved<br>
 
Submit a story<br>
Newsroom<br>
Water cooler
</div></TD></TR>
<TR>
<TD COLSPAN=8 class="divider">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=800 HEIGHT=1 ALT=""></TD>
</TR><?php } ?>
<TR>
<TD COLSPAN=6 id="content">
<div class="ptools">
<?php foreach($this->data['personal_urls'] as $key => $item) { ?><li id="pt-<?php echo htmlspecialchars($key) ?>"><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li><?php } ?>
 
</div>
<?php if($this->data['sitenotice']) { ?><div id="sitenotice"><?php $this->html('sitenotice')?></div><?php }?> <pre>
<?php /* echo htmlspecialchars(print_r($this->data))*/ ?></pre>
<?php if($this->data['title'] != 'Main Page') { ?><h1 class="contentheader"><?php $this->text('title') ?></h1><?php } ?>
<div class="c">
<?php if($this->data['title'] != 'Main Page') { ?><div id="tagline"><?php $this->msg('tagline') ?></div><?php } ?>
<?php if($this->data['title'] != 'Main Page') { ?><div id="csub"><?php $this->html('subtitle') ?></div><?php } ?>
 
<?php if($this->data['undelete']) { ?><div id="csub"><?php     $this->html('undelete') ?></div><?php } ?>
<?php if($this->data['newtalk'] ) { ?><div class="alert"><?php $this->html('newtalk')  ?></div><?php } ?>
<?php $this->html('bodytext') ?>
<?php if($this->data['catlinks']) { ?><div id="catlinks"><?php       $this->html('catlinks') ?></div><?php } ?>
</div><div class="visualClear"></div></TD>
<TD COLSPAN=2 class="sidebar" id="controls">
<div class="sidebartext">
<?php foreach($this->data['content_actions'] as $key => $action) { ?><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php echo htmlspecialchars($action['text']) ?></a><br><?php } ?>
<br>
<?php if($this->data['notspecialpage']) { foreach( array( 'whatlinkshere', 'recentchangeslinked' ) as $special ) { ?>
 
<a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href']) ?>"><?php echo $this->msg($special) ?></a><br>
<?php } } ?><?php if($this->data['feeds']) { ?><?php foreach($this->data['feeds'] as $key => $feed) { ?><span id="feed-<?php echo htmlspecialchars($key) ?>"><a href="<?php echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a><br></span>
<?php } ?><?php } ?><?php foreach( array('contributions', 'emailuser', 'upload', 'specialpages') as $special ) { ?>
<?php if($this->data['nav_urls'][$special]) {?><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href']) ?>"><?php $this->msg($special) ?></a><br><?php } ?><?php } ?>
</div></TD>
</TR>
<TR>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=450 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
 
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=49 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=55 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=17 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=28 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000">
<IMG SRC="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/spacer.gif" WIDTH=100 HEIGHT=1 ALT=""></TD>
<TD bgcolor="#000000"></TD>
</TR>
<TR>
<TD colspan="8" class="footer">
<div id="footertext"><?php if($this->data['lastmod'   ]) { ?><li id="lastmod"><?php    $this->html('lastmod')    ?></li><?php } ?>
<?php if($this->data['viewcount' ]) { ?><li id="viewcount"><?php  $this->html('viewcount')  ?></li><?php } ?>
 
<?php if($this->data['credits'   ]) { ?><li id="credits"><?php    $this->html('credits')    ?></li><?php } ?>
<?php if($this->data['copyright' ]) { ?><li id="copyrightt"><?php  $this->html('copyright')  ?></li><?php } ?>
<?php if($this->data['about'     ]) { ?><li id="about"><?php      $this->html('about')      ?></li><?php } ?>
<?php if($this->data['disclaimer']) { ?><li id="disclaimer"><?php $this->html('disclaimer') ?></li><?php } ?></div>
<div id="footericons"><?php if($this->data['poweredbyico']) { ?><li id="poweredbyico"><?php $this->html('poweredbyico') ?></li><?php } ?><?php if($this->data['copyrightico']) { ?><li id="copyrightico"><?php $this->html('copyrightico') ?></li><?php } ?></div></TD>
 
</TR>
<TR>
<TD colspan="8" class="divider"></TD>
</TR>
<TR>
<TD colspan="8" style="height: 0px"></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<?php
	}
}
?>

in /skins/wikinews/main.css

body {font-family:sans-serif}
a {color: navy;}
 
#logo {background-color: blue;
padding: 1em;
background:url(/w/skins/wikinews/wn-gradient.png)
blue repeat-x;}
.filler {background-color: #aaa; border:black thin solid; border-top:none;}
#regionsfiller {background-color:#444;}
#search { background-color:#666666;padding: 0.5em;padding-bottom:0.3em;border-top:thin solid black;}
.divider {background-color:black;}
 
#sbody form {display:inline;}
#sinput {display:inline;}
#sbutton {display:inline;font-size:x-small;font-weight:bold;}
 
#topics {background-color:#ccf; }
#topicstext {padding:0.6em;}
#topicstext li {list-style-type: none;}
#topicstext li a {text-decoration:none;color:black}
#topicstext li a:hover {text-decoration:underline;color:navy;}
#regionstext {list-style-type:none;text-align:right; }
#regions {background:#57D;padding-bottom:0.5em;padding-right:1em;}
#regionstext li a {color: white; text-decoration:none;}
#regionstext li a:hover {text-decoration:underline;}
#controls {vertical-align:top;padding-top:2em; }
 
.sidebar {background-color:#aaa;padding-left:0.5em;}
 
.ptools {padding:0.5em; text-align:right;}
.ptools li {display:inline;padding-right:1em;font-size:small;}
.footer li {list-style-type:none;padding:0.5em;display:inline;}
.footer a img {border:none;}
#copyrightico {float:right;}
#poweredbyico {float:left;}

In skins/WikiNews.deps.php

<?php
// This file exists to ensure that base classes are preloaded before
// MonoBook.php is compiled, working around a bug in the APC opcode
// cache on PHP 5, where cached code can break if the include order
// changed on a subsequent page view.
// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html
 
if ( ! defined( 'MEDIAWIKI' ) )
	die( 1 );
 
require_once( dirname( dirname( __FILE__ ) ) . '/includes/SkinTemplate.php');

In skins/wikinews/wn-gradient.png: media:wn-gradient.png

In skins/wikinews/spacer.gif put a 1 pixel big black dot. (I don't think it overly matters if it is actually there. a transparent dot may also work)