Fonts 将自定义字体连接到mediawiki的问题
向mediawiki-1.34.0添加字体时出现问题 我在LocalSettings.php中连接其他css文件,如下所示:Fonts 将自定义字体连接到mediawiki的问题,fonts,mediawiki,Fonts,Mediawiki,向mediawiki-1.34.0添加字体时出现问题 我在LocalSettings.php中连接其他css文件,如下所示: $wgResourceModules['custom.styles.whatever'] = array( 'scripts' => array( '/skins/Vector/resources/js/test.js' ), 'styles' => array(
$wgResourceModules['custom.styles.whatever'] = array(
'scripts' => array(
'/skins/Vector/resources/js/test.js'
),
'styles' => array(
'/skins/Vector/resources/css/header-footer.css'
)
);
function addMyCustomScripts(&$out)
{
$out->addModules('custom.styles.whatever');
return true;
}
$wgHooks['BeforePageDisplay'][] = 'addMyCustomScripts';
@font-face {
font-family: OpenSansRegular;
src: url('../fonts/OpenSansRegular.ttf') format('truetype');
}
在这些样式中,我连接如下字体:
$wgResourceModules['custom.styles.whatever'] = array(
'scripts' => array(
'/skins/Vector/resources/js/test.js'
),
'styles' => array(
'/skins/Vector/resources/css/header-footer.css'
)
);
function addMyCustomScripts(&$out)
{
$out->addModules('custom.styles.whatever');
return true;
}
$wgHooks['BeforePageDisplay'][] = 'addMyCustomScripts';
@font-face {
font-family: OpenSansRegular;
src: url('../fonts/OpenSansRegular.ttf') format('truetype');
}
在本地主机上一切都很正常。但在服务器上,CMS以一种奇怪的方式寻找字体:
样式如下:root wiki dir\skins\Vector\resources\css\
字体在这里:root wiki dir\skins\Vector\resources\font\
我不明白需要修复什么,以便在本地主机和站点上连接字体?我找到了一个原因。只需要在每个资源的每个路径的开头删除/删除
'skins/Vector/resources/css/header-footer.css'
我的XAMPP Windows服务器将//转换为/,据我所知,Linux服务器将此视为一条绝对路径