2011-01-10 64 views
0

有誰知道如何在不更改Joomla內核的情況下刪除元標記描述。我發現加起來$ this-> setDescription(null);在我的模板中它會工作,但這只是把標籤留空。我想要取消這一切。刪除Joomla 1.5中的元描述而不更改內核

我花了整個下午的研究,但它似乎是改變核心是唯一的選擇,但我不熟悉這個選項,因爲未來的升級可能會覆蓋我的更改。

在此先感謝!

回答

2
模板

/MyTemplate的/ component.php的index.php刪除以下內容:

<jdoc:include type="head" /> 

這將刪除所有元素

但這樣做也會刪除所有的JS & CSS不酷的文件!所以我會做的是這樣的:

訪問所有的頭元素的數組:$document = $this->getHeadData();

訪問路徑參考:$baseURL=JURI::base(true);

抓住所有的腳本(INC所有滿載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>"; 
}; 

抓住所有樣式表(INC所有滿載的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." />"; 
}; 

可以抓取所有內部腳本元素(例如,

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

抓住所有自定義腳本(如編輯器初始化PARAMS):

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

終於響徹<head>的陳述與腳本方法與addScriptDeclaration或JFactory :: getEditor增加)使用此:

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

調用它來抓取並刪除所有元頭? – themis 2013-05-22 19:05:47

1

此外的其他方式(不黑客co​​mponent.php)是在模板文件夾,即創建一個新的文件TMPL:

[path to install]/template/mytemplate/ 

該文件夾中會出現的index.php和component.php 您可以創建一個又一個如blank.php 並指定你想在這裏

<jdoc:include type="component" />

?tmpl=blank