I actually already have code for something like that:
/***** Functions to do things that aren't in SkinTemplate by default
*****/
/**
* Build an array of links for a box specified by a message name
*
* @return array
* @private
*/
function buildLinkBox( $msgName ) {
global $parserMemc, $wgEnableSidebarCache;
global $wgLang, $wgContLang;
$fname = 'BurningDespair::buildLinkBox';
wfProfileIn( $fname );
$key = wfMemcKey( $msgName );
$cacheBar = $wgEnableSidebarCache &&
($wgLang->getCode() == $wgContLang->getCode());
if ($cacheBar) {
$cachedbar = $parserMemc->get( $key );
if ($cachedbar!="") {
wfProfileOut($fname);
return $cachedbar;
}
}
$links = array();
$lines = explode( "\n", wfMsgForContent( $msgName ) );
foreach ($lines as $line) {
if (strpos($line, '*') !== 0)
continue;
if (strpos($line, '|') !== false) { // sanity check
$line = explode( '|' , trim($line, '* '), 2 );
$link = wfMsgForContent( $line[0] );
if ($link == '-')
continue;
if (wfEmptyMsg($line[1], $text =
wfMsg($line[1])))
$text = $line[1];
if (wfEmptyMsg($line[0], $link))
$link = $line[0];
if ( preg_match( '/^(?:' . wfUrlProtocols() .
')/', $link ) ) {
$href = $link;
} else {
$title = Title::newFromText( $link );
if ( $title ) {
$title =
$title->fixSpecialName();
$href = $title->getLocalURL();
} else {
$href = 'INVALID-TITLE';
}
}
$links[] = array(
'text' => $text,
'href' => $href,
'id' => 'n-' . strtr($line[1], ' ',
'-'),
'active' => false
);
}
}
if ($cacheBar)
$parserMemc->set( $key, $links, 86400 );
wfProfileOut( $fname );
return $links;
}
I just stick it in the Skin's template and use a $this->set( ... ); to
set up other parts of data to have the message data.
~Daniel Friesen(Dantman) of The Gaiapedia, Wikia Graphical Entertainment
Project, and Wiki-Tools.com
Uber Halogen wrote:
On 05/08/2007, Jamie Hari <[EMAIL PROTECTED]> wrote:
Oops!
It also appears as though an alternate display text isn't an option:
News:Contents|News
Comics:Contents|Comics
Marvel Database:Database|Database
Gallery:Contents|Gallery
I don't want it to say "News:Contents", I'd rather it just say, "News".
If I do the above, the links simply don't appear.
That would be a good feature request... ;)
Jamie
On 8/5/07, DanTMan <[EMAIL PROTECTED]> wrote:
Then I would suggest a list format. * has been used for the sidebar for
a good long time. It is easy to parse out into a list, and when rendered
in WikiText it gives a nice list of things. If I remember right, the
Licenses message uses it to. It would be the best to use.
~Daniel Friesen(Dantman) of The Gaiapedia, Wikia Graphical Entertainment
Project, and Wiki-Tools.com
Inez Korczyński wrote:
Jamie Hari pisze:
Hey John,
http://en.marveldatabase.com/index.php?title=MediaWiki:NavLinks&action=edit
<http://en.marveldatabase.com/index.php?title=MediaWiki:NavLinks&action=edit>
Ours is empty...
What is the format?
Newline delimited?
Hi,
The format is one title in line delimited by empty line. I just set
example links for marveldatabase.com.
Nota that this is probably temporary format, we are looking for
suggestions.
Inez
--
Jamie Hari
Editor-in-Chief
Marvel & DC Database Projects
On 8/4/07, *John Q* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] >> wrote:
Hi... to populate the 4 custom nav links at the top of the v2
skin...
use the MediaWiki:NavLinks page...
For example,
http://xyz.wikia.com/wiki/MediaWiki:NavLinks
<http://xyz.wikia.com/wiki/MediaWiki:NavLinks >
...
Thanks,
John Q.
_______________________________________________
Wikia-l mailing list
[email protected] <mailto:[email protected]>
http://lists.wikia.com/mailman/listinfo/wikia-l
------------------------------------------------------------------------
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l
Since the code already exists in the monobook skin it would be easy to
replicate. Please may I also direct the development team at an idea to
create a function which does what the sidebar in monobook currently
does. It could be put in Skin.php - there are many uses for it and
currently I am aware of several things that would be benefit from such
a function. The main advantage would be that it can more easily be
fixed if flaws are found and it would save disk space in the long run.
Thanks,
MinuteElectron.
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l
_______________________________________________
Wikia-l mailing list
[email protected]
http://lists.wikia.com/mailman/listinfo/wikia-l