【发布时间】:2014-07-31 22:53:44
【问题描述】:
以下 Joomla! 存在问题! 3.1 站点: http://www.kurapotheke-igls.at/
有两个css文件包含在:
<link rel="stylesheet" href="//media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap-responsive.css" type="text/css" />
这里的路径是错误的,前面有两个不应该存在的斜线。我用 YSlow 对其进行了测试,这两个文件导致了网站的极端加载时间。
奇怪的是,当我查看网站代码时,这两个文件包含了两次:
<link rel="stylesheet" href="http://www.kurapotheke-igls.at/media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="http://www.kurapotheke-igls.at/media/jui/css/bootstrap-responsive.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="//media/jui/css/bootstrap-responsive.css" type="text/css" />
下面是index.php文件的代码:
<?php
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$this->language = $doc->language;
// Add current user information
$user = JFactory::getUser();
// Add Bootstrap Framework
JHtml::_('bootstrap.framework');
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap.min.css');
JHtml::_('stylesheet', JUri::root() . 'media/jui/css/bootstrap-responsive.css');
// Add page class suffix
$itemid = JRequest::getVar('Itemid');
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getItem($itemid);
$params = $menu->getParams( $active->id );
$pageclass = $params->get( 'pageclass_sfx' );
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<jdoc:include type="head" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Stylesheets -->
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/icons/css/font-awesome.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/k2style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/joomla.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/css/template.css" type="text/css" />
<!-- Styles -->
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/<?php echo $this->params->get('templateStyles'); ?>.css" type="text/css" />
<?php if (isset($_GET['style'])) { $styles = $_GET['style']; }
if (isset($styles)) { ?>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/styles/style<?php
if ($styles == '1') {echo '1';} elseif ($styles == '2') {echo '2';} elseif ($styles == '3') {echo '3';} elseif ($styles == '4') {echo '4';} elseif ($styles == '5') {echo '5';} elseif ($styles == '6') {echo '6';} elseif ($styles == '7') {echo '7';} elseif ($styles == '8') {echo '8';} elseif ($styles == '9') {echo '9';} elseif ($styles == '10') {echo '10';} ?>.css" type="text/css" /> <?php }
else { echo ""; } ?>
<!-- Google Font -->
<link href='http://fonts.googleapis.com/css?family=<?php echo ($this->params->get('googleFont')) ? $this->params->get('googleFont') : "Open+Sans"; ?>' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=<?php echo ($this->params->get('textLogoGoogleFont')) ? $this->params->get('textLogoGoogleFont') : "Open+Sans"; ?>' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<?php // Parameters
require("admin/params.php"); ?>
<?php // Google Analytics Tracking Code
if($analyticsCode) {echo '<script type="text/javascript">'; echo $analyticsCode; echo '</script>';}?>
<script src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/backtop/backtop.js"></script>
</head>
你知道为什么 joomla 会包含这个错误的文件吗?
【问题讨论】:
-
鉴于您正在加载框架,为什么要单独包含这些文件?