Author |
Message |
Dawg
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/46907b8543f928e08c8d7.gif)
Joined: Nov 07, 2003
Posts: 928
|
Posted:
Thu Jun 25, 2009 9:17 pm |
|
I have a Module that I need to add a couple of LARGE JS files to but like I said they are LARGE and I do not want to add them in javascript.php becasue I don't want them loading all the time....just in this one module.
Do I just make an If statement in javascript.php?
Dawg |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Thu Jun 25, 2009 9:32 pm |
|
If they need loaded in the HEAD that is pretty much your only option at the moment. We will have something for this in 2.4 and if we don't it will be over my dead body ![Wink](modules/Forums/images/smiles/icon_wink.gif) |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/48fb116845dfecf66294c.gif)
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Thu Jun 25, 2009 11:06 pm |
|
for now:
in includes/javascript.php
after global $name add:
if ($name == 'Your_Module') {
echo '<s cript type="text/javascript" src="myreallybig.js"></s cript>'."\n";
}
you can also make it load for users only by changing global $name to global $name, $user and:
if(is_user($user)) {
echo '<s cript type="text/javascript" src="myreallybig.js"></s cript>'."\n";
} |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
eldorado
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/52f4453749f5c4a233463.gif)
Joined: Sep 10, 2008
Posts: 424
Location: France,Translator
|
Posted:
Fri Jun 26, 2009 1:23 am |
|
Would be nice to have a check on every module too (or instead)?
like have a specific folder in each module
$filename= "modules/$name/Javascript/javascript.php";
if (file_exists($filename)) {
include javascript.php; } |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Dawg
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jun 26, 2009 5:32 am |
|
I figured it could done with an IF statement. Thank You....That is what I was looking for.
I am trying to preload some stuff that runs my maps. They are LARGE js files and they take a while to download so instead of loading them when they go into the map....we are going to preload them when they go into the module.
Thank You for your help!
Dawg |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
Site Admin
![](modules/Forums/images/avatars/125904890252d880f79f312.png)
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri Jun 26, 2009 3:09 pm |
|
As code maintenance is always an issue you could also add that code into your
includes/custom_files/custom_head.php
If that file doesn't exist, simply create it with that file name as header.php will look for it.
Putting in that file should stop it getting over written during updgrades. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jun 27, 2009 12:23 am |
|
Guardian2003 wrote: | As code maintenance is always an issue you could also add that code into your
includes/custom_files/custom_head.php
If that file doesn't exist, simply create it with that file name as header.php will look for it.
Putting in that file should stop it getting over written during updgrades. |
This is defiantly the best way. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|