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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:31:20+00:00 2026-06-03T20:31:20+00:00

I just trying to add a js file but I cant get it to

  • 0

I just trying to add a js file but I cant get it to work… I have googled but not found any help yet.. any help is much appreacheated

This is my code:

<?php

defined('_JEXEC') or die('Restricted access');
jimport('joomla.plugin.plugin');

class plgSystemInfinityScroll extends JPlugin {
protected $_execute;

function __construct(&$subject, $config) {
    $app = JFactory::getApplication();

    if($app->isAdmin())
    {
        return;
    }

    parent::__construct($subject, $config);
    $this->loadLanguage('', JPATH_ADMINISTRATOR);
    $this->_execute = true;
}

public function onBeforeCompileHead() {

    $document =& JFactory::getDocument();
    $document->addScript('/plugins/system/sjdinfinitescroll/jquery.infinitescroll.js');

}

public function onAfterRender() {

}

}
  • 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-06-03T20:31:21+00:00Added an answer on June 3, 2026 at 8:31 pm

    First of all, Id use the plugin event:

    function onBeforeRender(){
    
    }
    

    Secondly your path is pointing wrong.

    Change it to:

    //J1.6+
    $script= JURI::root(true).DS.'plugins'.DS.'system'.DS.'sjdinfinitescroll'.DS.'jquery.infinitescroll.js';
    $document =& JFactory::getDocument();
    $document->addScript($script);
    

    If you have MooTools loaded on the same page, you have to use jQuery.noConflict(); to avoid conflicts.

    All together:

    function onBeforeRender(){
          $script= JURI::root(true).DS.'plugins'.
               DS.'system'.DS.'sjdinfinitescroll'.DS.'jquery.infinitescroll.js';
          $document =& JFactory::getDocument();
          $document->addScript($script);
          $document->addScriptDeclaration('jQuery.noConflict();');
          $document->addScriptDeclaration('jQuery(function($){ $('#myid'.append('<h2>my header</h2>');} );');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to get diff to work better for certain kinds of documents. With
I'm just trying to add 2 columns to customer table alter table CUSTOMER ADD
I am trying to add/remove UILabels to a ScrollView. The adding takes place just
I'm just new to Zend and currently I'm trying to add a dash(-) to
I am trying a very simple override. I just want to add one line
just trying to test for equality in this piece of code, but getting a
Just trying to still get my head around IOC principles. Q1: Static Methods -
Just trying to establish whether prototype can do something like $$('#ID a:last').css('color','#111'); Any ideas
Just trying to get my head around what can happen when things go wrong
I'm trying to get data from file. The file first has three lines of

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.