F
F
FinchRED2021-07-27 11:17:31
PHP
FinchRED, 2021-07-27 11:17:31

Why do libraries registered in the init of the bx library work on all pages?

AddEventHandler("main","OnEpilog",array("JsTestClass","OnEpilogHandler"));
class JsTestClass{
  function OnEpilogHandler(){
    
    CJSCore::RegisterExt('lib2_1', array(
  'js' => '/local/js/lib2_1/lib2_1.js',
  'css' => '/local/js/lib2_1/lib2_1.css',
  'lang' => '/local/js/lib2_1/lang/'.LANGUAGE_ID.'/lib2_1.php'
));

CJSCore::RegisterExt('bxjs2_2', array(
  'js' => '/local/js/bxjs2_2/bxjs2_2.js',
  //'css' => '/local/js/lib2_1/lib2_1.css',
  'lang' => '/local/js/bxjs2_2/lang/'.LANGUAGE_ID.'/bxjs2_2.php'

));
    //};
   //CJSCore::Init(array("bxjs2_2"));
  //CJSCore::Init(array("ajax"));
//CJSCore::Init(array('lib2_1'));
  }

};

In theory, the page should be connected in these ways.
And then the libraries should work when on these pages. But they work everywhere.
CUtil::InitJSCore(array('lib2_1'));
CJSCore::Init(array("lib2_1"))

CUtil::InitJSCore(array('bxjs2_2'));
CJSCore::Init(array("bxjs2_2"))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Edward, 2021-07-29
@Drayde

Maybe because init is connected on all pages..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question