MediaWiki 皮肤 - 与主页不同的文章页面
MediaWiki Skinning - Article page different then homepage
希望这篇文章能让大家身体健康。
我正在从头开始创建 MediaWiki 皮肤。主页设计与文章页面有很大不同,实际上none的主页元素在文章页面存在。
所以我想知道如何单独为文章页面设置皮肤,我的意思是我是否必须为文章页面创建任何文件以进行不同的设计?
提前感谢您抽出时间回答我的问题。
主页和其他页面会调用相同的皮肤,但在您的皮肤中使用单独的代码很容易class。如果 $title->isMainPage()
为真,只需检查您的皮肤,然后执行您要用于呈现主页的任何代码。你的皮肤看起来像这样:
<?php
class MySkinTemplate extends BaseTemplate {
public function execute() {
/* Print out header */
$this->html( 'headelement' );
$title = $this->getSkin()->getTitle();
if ($title->isMainPage()){
echo( '<h1>Welcome to the main page!</h1>' );
$this->html( 'bodytext' );
} else {
echo( '<h1>' );
$this->html( 'title' );
echo( '</h1>' );
$this->html( 'bodytext' );
}
$this->printTrail();
}
}
硒也:
- In MediaWiki is there a way to force a group of pages to have a particular skin?
希望这篇文章能让大家身体健康。
我正在从头开始创建 MediaWiki 皮肤。主页设计与文章页面有很大不同,实际上none的主页元素在文章页面存在。
所以我想知道如何单独为文章页面设置皮肤,我的意思是我是否必须为文章页面创建任何文件以进行不同的设计?
提前感谢您抽出时间回答我的问题。
主页和其他页面会调用相同的皮肤,但在您的皮肤中使用单独的代码很容易class。如果 $title->isMainPage()
为真,只需检查您的皮肤,然后执行您要用于呈现主页的任何代码。你的皮肤看起来像这样:
<?php
class MySkinTemplate extends BaseTemplate {
public function execute() {
/* Print out header */
$this->html( 'headelement' );
$title = $this->getSkin()->getTitle();
if ($title->isMainPage()){
echo( '<h1>Welcome to the main page!</h1>' );
$this->html( 'bodytext' );
} else {
echo( '<h1>' );
$this->html( 'title' );
echo( '</h1>' );
$this->html( 'bodytext' );
}
$this->printTrail();
}
}
硒也:
- In MediaWiki is there a way to force a group of pages to have a particular skin?