在 Joomla 1.5 中删除元描述而不更改核心

发布于 2024-10-11 07:31:51 字数 188 浏览 2 评论 0原文

有谁知道如何在不更改 Joomla 核心的情况下删除元标记描述。我发现添加 $this->setDescription(null);在我的模板中它可以工作,但这只是将标签留空。我想把它完全脱掉。

我花了整个下午的时间进行研究,但似乎更改核心是唯一的选择,但是我对这个选项不满意,因为未来的升级可能会覆盖我的更改。

提前致谢!

Does anybody know how can I remove the meta tag description without changing Joomla core. I found that addingup $this->setDescription(null); in my template it would work but this just leave the tag empty. I'd like to take this off at all.

I have spent the whole afternoon researching but it seems like changing core is the only option, however I'm not comfortable with this option since a future upgrade may overwrite my changes.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不美如何 2024-10-18 07:31:51

在 templates/mytemplate/ component.php /index.php 中删除以下内容:

<jdoc:include type="head" />

这将删除所有元素

,但它也会删除所有 js 和css 文件这不酷!所以我要做的是:

以数组形式访问所有头元素: $document = $this->getHeadData();

访问路径引用: $baseURL=JURI: :base(true);

抓取所有脚本(包括所有使用 addScript() 方法加载的脚本):

foreach ($document[scripts] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$scripts .= "<script type=".$value." src=".$url."></script>";
};

抓取所有样式表(包括所有使用 addStyleSheet() 方法加载的脚本):

foreach ($document[styleSheets] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$style .= "<link rel='stylesheet' type=".$value[mime]." href=".$url." />";
};

抓取所有内部脚本元素(例如添加了addScriptDeclaration 或 JFactory::getEditor) 与 script 方法一起使用:

foreach ($document[script] as $key=>$value){
 $scripts .= "<script type=".$key." >".$value."</script>";
}

获取所有自定义脚本(例如编辑器初始化参数):

foreach ($document[custom] as $value){
$custom .= $value;
}

最后回显 中的语句:

<?
echo $style;
Echo $scripts;
echo $custom;
?>

in templates/mytemplate/ component.php /index.php remove the following :

<jdoc:include type="head" />

this will remove all elements

however it will also remove all js & css files which is not cool! so what i would do is this:

to access all the head elements as an array: $document = $this->getHeadData();

to access path ref: $baseURL=JURI::base(true);

to grab all scripts (inc all loaded with addScript()method) :

foreach ($document[scripts] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$scripts .= "<script type=".$value." src=".$url."></script>";
};

to grab all stylesheets (inc all loaded with addStyleSheet()method):

foreach ($document[styleSheets] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$style .= "<link rel='stylesheet' type=".$value[mime]." href=".$url." />";
};

to grab all internal script elements (e.g. added with addScriptDeclaration or JFactory::getEditor) use this with the script method:

foreach ($document[script] as $key=>$value){
 $scripts .= "<script type=".$key." >".$value."</script>";
}

to grab all custom scripts (e.g. editor initialization params) :

foreach ($document[custom] as $value){
$custom .= $value;
}

finally echo the statements in the <head> :

<?
echo $style;
Echo $scripts;
echo $custom;
?>
疯狂的代价 2024-10-18 07:31:51

另一种方法(不破解 component.php)是在模板文件夹中创建一个新的 tmpl 文件,即:

[path to install]/template/mytemplate/

在该文件夹中将有 Index.php 和 component.php
你可以创建另一个,例如blank.php
指定所需的标头,

并使用

使用 ?tmpl=blank 调用它

Also the other way (without hacking the component.php) is to create a new tmpl file in the template folder i.e:

[path to install]/template/mytemplate/

in that folder there will be Index.php and component.php
you can create another one e.g. blank.php
and specify the headers you want here

with <jdoc:include type="component" />

call it with ?tmpl=blank

凉月流沐 2024-10-18 07:31:51

这可以通过插件来完成。据我所知,没有一个可以完全删除标签,但是这是一个可以完全删除生成器标签的插件。您可以轻松修改此插件,以对描述标签执行相同的操作。

http://extensions.joomla.org/extensions/site-management /seo-a-metadata/12556

This can be done with a plugin. There isn't one that removes the tag entirely that I know of, however these is a plugin that removes the generator tag completely. You could easily modify this plugin to do the same for the description tag instead.

http://extensions.joomla.org/extensions/site-management/seo-a-metadata/12556

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文