【问题标题】:How can I remove the <meta http-equiv="content-type" content="text/html; charset=utf-8" /> of Joomla?如何删除 Joomla 的 <meta http-equiv="content-type" content="text/html; charset=utf-8" />?
【发布时间】:2017-06-28 06:31:13
【问题描述】:

如何删除&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;

在这个 PHP Joomla 模板上?因为我从 Joomla 和模板中复制了元标记:/ 它正在调用的 Head.php 文件是:

<meta charset="<?php echo $this['system']->document->getCharset(); ?>">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<?php if($this['config']->get('responsive', true)): ?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php endif; ?>
<?php if (isset($error)): ?>
<title><?php echo $error; ?> - <?php echo $title; ?></title>
<?php else: ?>
<jdoc:include type="head" />
<?php endif; ?>

Index.php 是:

// get theme configuration
include($this['path']->path('layouts:theme.config.php'));

?>
<!DOCTYPE HTML>
<html lang="<?php echo $this['config']->get('language'); ?>" dir="<?php echo $this['config']->get('direction'); ?>"  data-config='<?php echo $this['config']->get('body_config','{}'); ?>'>

    <head>
    <?php echo $this['template']->render('head'); ?>
    </head>

    <body class="<?php echo $this['config']->get('body_classes'); ?>">

这是这个问题的图像: Link to the Problem ( imgur )

【问题讨论】:

    标签: php html joomla character-encoding header


    【解决方案1】:

    如果我正确理解您的问题。是否要删除重复的图表集?
    简单地删除您的第一个代码示例中的第一行。 您可以在 index.php 中尝试$doc-&gt;setHtml5(true);

    【讨论】:

    • 是的,这就是我想要的 :) 抱歉这个愚蠢的问题...我是 PHP 的菜鸟,我应该在哪里将 $doc-&gt;setHtml5(true); 放在 index.php 中?
    • setHtml5(true); ?> 在 Head 部分的任何位置,或者在现有的 中更好。
    • 如果我删除 &lt;meta charset="&lt;?php echo $this['system']-&gt;document-&gt;getCharset(); ?&gt;"&gt; 它根本不会渲染头部:/
    • 这应该只删除头部的这一行。通过保存转换文件,您的编辑器可能有问题。
    • 好的,我修好了 :) 问题是我需要调用文档 :) &lt;?php $document = JFactory::getDocument(); $document-&gt;setHtml5(true); ?&gt; &lt;meta http-equiv="x-ua-compatible" content="ie=edge"&gt;
    猜你喜欢
    • 2015-08-24
    • 2011-06-09
    • 2017-12-09
    • 1970-01-01
    • 1970-01-01
    • 2018-03-12
    • 2020-07-30
    • 1970-01-01
    相关资源
    最近更新 更多