Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.30.01 RN All Other Issues
Author Message
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Thu Jun 25, 2009 9:17 pm Reply with quote

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
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Thu Jun 25, 2009 9:32 pm Reply with quote

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

_________________
"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. 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Thu Jun 25, 2009 11:06 pm Reply with quote

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";
}
 
View user's profile Send private message Visit poster's website
eldorado
Involved
Involved



Joined: Sep 10, 2008
Posts: 424
Location: France,Translator

PostPosted: Fri Jun 26, 2009 1:23 am Reply with quote

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; }
 
View user's profile Send private message Visit poster's website MSN Messenger
Dawg







PostPosted: Fri Jun 26, 2009 5:32 am Reply with quote

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
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Jun 26, 2009 3:09 pm Reply with quote

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.
 
View user's profile Send private message Send e-mail
Palbin







PostPosted: Sat Jun 27, 2009 12:23 am Reply with quote

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.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.30.01 RN All Other Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©