Browse All Articles > Adding a JavaScript or CSS tag to your Joomla header! (per page - not site wide).
First of all, we will need Jumi component or Sourcerer plugin for this to work. We need either of these because the main focus here is custom development outside of the standard modules or articles within Joomla.
*Jumi is a component that allows you to write custom php and js pages and load them into your Joomla site. So, if you are needing to add some AJAX or interactivity to your website, Jumi is the component for you. Jumi is compatible with J1.0, J1.5, and J1.6. With Jumi, you can add custom content to your modules, articles, etc...
When custom coding your pages and you need to add a little javascript or css to it, normally you would have to add those links to the <head></head> location of your template's index.php page...however, now these scripts and css are applied site wide and might mess up the scripts and the css for the template on every page. There's is a way that you can add these scripts and css pages WITHOUT having to manually add them to your index.php page and that won't affect the entire site's scripts or css.
If you plug this in at the top of your customized php page, you will get the results you need only on the pages you add this code to.
This will add the script and css file to the <head> tag for that particular page. Then you can feel free to modify that page without worrying about messing up the entire site.
Comments (14)
Author
Commented:It would look something like this:
Open in new window
Commented:
Open in new window
Author
Commented:Open in new window
Naturally, you will need to change the location of where the files are pointing. In the misc.js file put your code:
Open in new window
See if that loads properly for you.
Author
Commented:Change the previously place code above to this:
Open in new window
That should give you the correct paths.
Also remember to add that additional script to misc.js and save that file in the functions/misc.php location.
Commented:
Regards,
Abhijit
View More