Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
transit
Regular
Regular



Joined: Jun 01, 2010
Posts: 69

PostPosted: Thu Jun 03, 2010 7:10 pm Reply with quote

I have spent a good part of an hour just trying to find simple code to link to a JS file and how to put it into the header. Suppossing it is code.js what <script> code do I need and what file and where should I put it? I want it to appear in every theme and every page loaded. I remember back in the day the old nukes had a themeheader.tpl or something you could put it in.

Any help is greatly appreciated!
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Thu Jun 03, 2010 7:22 pm Reply with quote

With RavenNuke, we have made that simple to do. Create a php file in includes/addons named head-yourfilename.php

in that file you can call the js or css file and it will be loaded into an array. Here is an example of what you need to put in the file:

Code:
<?php


addJSToHead('location/to/your.js', 'file');

?>


It will load on everypage everytime. Of course, use the correct path to your js file.

http://rnwiki.ravennuke.com/wiki/RavenNuke2:Loading_CSS_and_JavaScript

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
spasticdonkey
RavenNuke(tm) Development Team



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

PostPosted: Fri Jun 04, 2010 10:30 am Reply with quote

here is a demo that kguske put together as well Wink
we still need to link this from the wiki....
kguske wrote:
No need to peel your eyes for long, spasticdonkey! Smile

Only registered users can see links on this board! Get registered or login! is a file that includes examples of how to create addons that require CSS and / or JS at the following levels:

- site HEAD section: nukeINFO(tm) (admin PHP info function)
- site BODY section: nukeSTATS(tm) featuring Google Analytics
- module HEAD section: nukeGAMES(tm) featuring jQuery Sudoku by Chip Camden

The only change required is to rnconfig.php if you want to use Google Analytics. This could be added as a database configuration if we move in the direction of a more flexible configuration file. But for purposes of demonstrating RN's dynamic CSS / JS load process for addons, this should suffice. It even includes samples of how to develop addons that work with RN's dynamic CSS / JS load and with other Nuke flavors that don't support that.

After vetting this, if there are no major issues, I'll update the wiki to refer to this, too.
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

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 ©