2012-05-21 10 views
13

पेजपेज से अवांछित js फ़ाइलें निकालने के लिए कैसे joomla-

से अवांछित js फ़ाइलें निकालने के लिए कैसे joomla- मैं प्लगइन्स कुछ पृष्ठों इतने सारे js फ़ाइलें शामिल किए गए हैं इस्तेमाल किया है सभी पृष्ठों में

+0

यदि प्लगइन द्वारा जावास्क्रिप्ट फ़ाइल की आवश्यकता होती है, तो यदि आप इसे हटाते हैं तो आप परेशानी में भाग सकते हैं। प्लगइन को हटाने के लिए बेहतर नहीं होगा? यह जावास्क्रिप्ट फ़ाइल को भी हटा देना चाहिए। – Okonomiyaki3000

उत्तर

23

दो तरीके है कि मैं के बारे में पता कर रहा हूँ कर रहे हैं) जे एस फ़ाइलें आपके टेम्पलेट्स index.php से सीधे निकालें:

<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?> 
0

आप बस संपादित कर सकते हैं इन फ़ाइलों को हटाने के लिए इन प्लगइन्स कोड। या यदि आवश्यक नहीं है तो इन प्लगइन्स को अनइंस्टॉल करें।

1) एक उदाहरण मिलता है दस्तावेज़ वस्तु और जे एस फ़ाइलों को हटा दें (तुम कर सकते हो कि एक प्लगइन में):

<?php 
     //get the array containing all the script declarations 
     $document = JFactory::getDocument(); 
     $headData = $document->getHeadData(); 
     $scripts = $headData['scripts']; 

     //remove your script, i.e. mootools 
     unset($scripts['/media/system/js/mootools-core.js']); 
     unset($scripts['/media/system/js/mootools-more.js']); 
     $headData['scripts'] = $scripts; 
     $document->setHeadData($headData); 
?> 
-7
**An easiest way to disable mootools/ unwanted javascripts for your site in joomla cms (2.5 version)**(still loads it for your admin) 


**Step-1:** 
Using your favorite file editor, open for edit: 
libraries/joomla/document/html/renderer/head.php 

**Step-2:** check for code in head.php 

// Generate script file links 
foreach ($document->_scripts as $strSrc => $strAttr) 
{ 
// *** start *** // 
$ex_src = explode("/",$strSrc); 
$js_file_name = $ex_src[count($ex_src)-1]; 
$js_to_ignore = array("mootools-more.js","core.js"); // scripts to skip loading 
//skip loading scripts.. 
if(in_array($js_file_name,$js_to_ignore) AND substr_count($document->baseurl,"/administrator") < 1 AND $_GET['view'] != 'form'){continue;} 
// *** end *** // 


**Step-3:** 
Clear cache & refresh page. 


it works for sure. 

For detailed explanation : http://www.inmotionhosting.com/support/edu/joomla-25/302-disable-mootools-in-joomla-25 
+5

कोर फ़ाइलों को संशोधित करने की सलाह नहीं दी जाती है – betweenbrain

5

आप सभी स्क्रिप्ट को निकालना चाहते हैं कि जो omla इनलाइन स्क्रिप्ट सहित, कहते हैं, तेज तरीका यह है:

$this->_script = $this->_scripts = array(); 

<head> अनुभाग के ऊपर अपने टेम्पलेट फ़ाइल में इस कहीं भी जोड़ें।

संबंधित मुद्दे