Documentation

In-house extensions registration

CJSCore::RegisterExt(
    "my_extension", 
    array(
        "js" => "/path/to/js/my_ext.js",
        "css" => "/path/to/css/my_ext.css",
        "lang" => "/path/to/lang/".LANGUAGE_ID. "/lang.php",
        "rel" => Array("ajax", "popup", "ls"),    
        "skip_core" => false | true,
    )
);

The function registers custom in-house extensions.

Function parameters

Parameter Description
my_extension Extensions name
Array Array of extension parameters:
  • js - Path to extension file;
  • css - Path to the extension css file;
  • lang - Path to the extension language file;
  • rel - List of "dependencies". When connecting your own extension, dependencies will be connected automatically.
  • skip_core - When connecting extensions, the core.js connection is not required.

Example

<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("My own extensions");

   CJSCore::RegisterExt("db_js_demo", Array(
      "js" =>    "/script_demo.js",
      "lang" =>   "/lang_js.php",
      "rel" =>   array('jquery')
   ));
   CJSCore::Init(array("db_js_demo"));
?>
<div id="hideBlock" style="display:none;">
   <h1>Hello</h1>
   <p>text</p>
</div>
<script>
   window.BXDEBUG = true;
BX.ready(function(){
   BX.PREFIXName('HELLO');
   //BX.PREFIXName.testJQ('#demo');
});
</script>
<p id="demo">click Me</p>
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>


© «Bitrix24», 2001-2024
Up