gpt4 book ai didi

php - Joomla 错误的媒体目录路径导致加载时间过长

转载 作者:行者123 更新时间:2023-11-28 17:37:37 27 4
gpt4 key购买 nike

以下 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 包含这个错误的文件吗?

最佳答案

我有同样的错误,在我的例子中,主页上发布的模块试图加载 bootstrap.min.css,但该模块的 php 文件拼写错误。该路径在媒体目录之前有一个斜线,生成指向//media/jui 的链接...尝试在您的模块代码中搜索“/media/jui/css/bootstrap.min.css”并删除斜杠。它对我有用。

JHTML::stylesheet('media/jui/css/bootstrap.min.css');

关于php - Joomla 错误的媒体目录路径导致加载时间过长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24800188/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com