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 3431990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:23:39+00:00 2026-05-18T07:23:39+00:00

I have a front-end component view that I need to include a .js file

  • 0

I have a front-end component view that I need to include a .js file in the header of (header is being generated by Joomla, not hard-coded in default.php). The front-end component file is mysite.com/components/com_arrcard/views/tmpl/default.php; the javascript file is located at mysite.com/administrator/components/com_arrcard/js/CalendarPopup.js.

Here’s what I tried in my default.php:

$document =& JFactory::getDocument();
$popUrl = JURI::root(true).'/website/documents/ccv.html';
$popImage = JURI::root(true).'/website/documents/cv_card.jpg';
$popPhone = JURI::root(true).'/website/documents/phone.html';

$document->addScript( JURI::root(true).'/administrator/components/com_arrcard/js/CalendarPopup.js' );

The $popImage and $popPhone variables are getting set correctly, but the script is not being added – when I look at the rendered page source, CalendarPopup.js isn’t anywhere.

Can anyone help me out? What am I doing wrong here? I’ve also tried

$document->addScript('administrator/components/com_arrcard/js/CalendarPopup.js' );

That doesn’t work either. The addScript code does work when including the exact same file in a view in the administrator com_arrcard component. Is there some limitation on where addScript works?

  • 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-18T07:23:39+00:00Added an answer on May 18, 2026 at 7:23 am

    Your code does look correct. Perhaps try another method below, the first line is to include JS while the other for CSS (just in case someone stumbles upon this in future looking for css include).

    JHTML::script( 'javascript.js', 'components' . DS . 'com_component' . DS . 'lib' . DS . 'js' . DS );
    JHTML::stylesheet( 'style.css', 'components' . DS . 'com_component' . DS . 'lib' . DS . 'css' . DS );
    

    Ensure that you use the DS (directory separator) so that Joomla can fill in the correct / or \ depending on the OS the site is running on.

    So in your case you would need this line of code:

    JHTML::script( 'CalendarPopup.js', 'administrator' . DS . 'components'. DS .'com_arrcard'. DS .'js');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django webapp that has both a front-end, web-accessible component and an
I have a .NET webforms front end that allows admin users to upload two
I have a very simple ASP.Net page that acts as a front end for
I have a few ASP.Net database front-end websites where MS Access is the back-end.
We have a client/server application with a rich client front end (in .Net) and
We have a DLL used as the middle layer between our website front end
I have downloaded a font that looks less than desirable if it is not
I have a project in two parts: a Silverlight front end and a WCF
I have problems with bringing a windows mobile 6 form to the front. I
I have apache web server installed as frontend and I have j2ee SAP Netweaver

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.