Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6797947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:40:17+00:00 2026-05-26T18:40:17+00:00

I am starting out with Joomla and am writing a simple Joomla module. I

  • 0

I am starting out with Joomla and am writing a simple Joomla module. I am using some custom CSS and JS in my module. Now when I distribute this module I need my JS/CSS files to go with the ZIP. I have added my files in my module ZIP file.

This is what i need to know –

  1. How do I refer to these CSS/JS files in my module so that even if I distribute the module as a zip i would not have to send the css/js files separately?

  2. I tried looking at different solutions including
    http://www.howtojoomla.net/how-tos/development/how-to-add-cssjavascript-to-your-joomla-extension But I was not able to figure out what the URL for the JS/CSS file should be?

I am using Joomla 1.7 hosted on a cloud hosting site.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:40:17+00:00Added an answer on May 26, 2026 at 6:40 pm

    I’d say that the HowToJoomla Site’s article pretty much sums up the process.

    Here is the process with a few more steps added – hopefully this will help.

    I am assuming you have got as far as packaging your extension and have been able to get your css and javascript files to install on the server. They may be in your module folder, or probably more correctly they should be within your modules sub-folder under the /media/ folder.

    If after installing the module you can not locate your css and js files it is because you haven’t referenced them correctly within your component’s xml installation file. This page contains info about the xml installation / manifest file for 1.6/1.7 add-ons although it is for a component: http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!1.6_-_Part_01 they are very similar.

    Either way – find your files within Joomla’s folder structure and make a note of their relative path from the root of the website – ie the folder containing configuration.php

    Now somewhere within your module’s php – add the line that gets a reference to the JDocument object.

    $document = JFactory::getDocument();
    

    Now add the line that adds your javascript to the html head area:

    $document->addScript('url/to/my/script.js');
    

    obviously replace ‘url/to/my/script.js’ with the actual relative path to your javascript.

    Now add the line that adds your css to the html head:

    $document->addStyleSheet('url/to/my/stylesheet.css');
    

    again adjust the path – it may for example be media/mod_mymodule/mymodule.css (if your module were called ‘mymodule’).

    Only things to be aware of are that you need to add these lineswithin executable php tags NOT within a html area after exiting php mode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting out, this should be a simple one but I haven't been able
I'm starting out with some XML that looks like this (simplified): <?xml version=1.0 encoding=UTF-8?>
Just starting out with C#, so this may be overly simple that I keep
I am just starting out with RoR, and I'm having some problems. I'm using
I'm just starting out with WPF and need some help with routed events. I
Just starting out in Unix and need t workout this:- I have a csv
I'm just starting to evaluate joomla CMS as a tool to build out my
I'm just starting out with using Core Data on the iPhone SDK and I'm
Just starting out with an iPhone application using xcode 4.2. I understand that it
After starting out with Python on Ubuntu Linux, I've now for a good while

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.