Help With includes

  • Sohaib
  • Proficient
  • Proficient
  • User avatar
  • Posts: 327
  • Loc: Las Vegas

Post 3+ Months Ago

is there a way to Make a file or something of 'Javascript codes' and it will apply to every page in the Website instead of going to Every page and adding it individualy ??
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Vladdrac
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2136
  • Loc: Louisville, Ky

Post 3+ Months Ago

I think, though not sure, that you can acheive this by php. You will php include 'something' and it should print out everything you want it to in the html.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

You can link an external .js file by putting the code (removing the script tags and html comments if present) in a file that you can then link from the head of all your pages:

Code: [ Select ]
<script type="text/javascript" src="path/filename.js"> </script>
  • DR01D
  • Expert
  • Expert
  • User avatar
  • Posts: 661
  • Loc: Australia

Post 3+ Months Ago

RichB, thats the way i do it aswell. so i can recommend it ;-)
  • Vladdrac
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2136
  • Loc: Louisville, Ky

Post 3+ Months Ago

yeah sorry about my stupid suggestion, I know nothing of js
  • Sohaib
  • Proficient
  • Proficient
  • User avatar
  • Posts: 327
  • Loc: Las Vegas

Post 3+ Months Ago

Thank you guys for all your help, you girls are so helpful, ohh I mean guys'
  • DR01D
  • Expert
  • Expert
  • User avatar
  • Posts: 661
  • Loc: Australia

Post 3+ Months Ago

yeah thanx miriam ;-)
  • Sohaib
  • Proficient
  • Proficient
  • User avatar
  • Posts: 327
  • Loc: Las Vegas

Post 3+ Months Ago

miriam ?

confused ?
hehe
  • panreach
  • Novice
  • Novice
  • User avatar
  • Posts: 28

Post 3+ Months Ago

you can use
include(); # php

<!--#include file="blah"--> 'asp

or, I know there's one for shtml too...

oh

it's the same as asp above.
  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

You could include the js code on every page with a server side include or script, but I think the drawback would be that the included code would be sent with every page that had the include statement. I'm pretty sure the browser will cache a separate .js file and not download it over and over again if you use the script tag with the src attribute.
  • conorific
  • Proficient
  • Proficient
  • User avatar
  • Posts: 350
  • Loc: NY

Post 3+ Months Ago

Vladdrac and panreach: I know nothing of JavaScript either. I agree with you on the PHP, although I'm not really clear on what this person's trying to include...

Post Information

  • Total Posts in this topic: 11 posts
  • Users browsing this forum: No registered users and 64 guests
  • 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 post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.