Dynamically printing the DHTMLX Sidebar gives a strange error

Hi There, I’m trying to print dynamically the Sidebar contents via a PHP variable. The file that I want to print is as given below:



        <script language="JavaScript" type="text/javascript" src="./codebase/dhtmlx.js"></script>
        <link rel="stylesheet" type="text/css" href="./skins/web/dhtmlx.css" />
<script language ="JavaScript" type = "text/javascript"src=".s/codebase/connector.js"></script> -->
            /* important to set width/height to 100% for fullscreen init */
            body {
                width: 100%;
                height: 100%;
                margin: 0px;
                padding: 0px;
                overflow: auto;
        <title>Club Management System</title>

    <body onload="doOnLoad();">
            function doOnLoad() {

                window.skin = "web";
                window.dhx4.skin = 'dhx_web';

                var main_layout = new dhtmlXLayoutObject(document.body, '1C');
                var a = main_layout.cells('a');
                a.setText('Welcome to Club Management System');

                var mySidebar = a.attachSidebar({
                    template: 'text',
                    width: '175',
                    icons_path: '.s/skins/web/imgs/dhxsidebar_web',
                    autohide: '',
                    header: ''
                document.write('<?php echo $container; ?>'); // This line is is where the error comes into play



The PHP variable “$container” returns the following result:

mysidebar.addItem({id:‘rolelist’,text:‘Roles Listing’});
var rolelist = mysidebar.cells(‘rolelist’);

mysidebar.addItem({id:‘roleform’,text:‘Roles Creation’});
var roleform = mysidebar.cells(‘roleform’);

mysidebar.addItem({id:‘usr_role_list’,text:‘User Roles Listing’});
var usr_role_list = mysidebar.cells(‘usr_role_list’);

mysidebar.addItem({id:‘usr_role_form’,text:‘User Role Creation’});
var usr_role_form = mysidebar.cells(‘usr_role_form’);

I’m trying to print this and I get the following error as shown in my console snapshot:

This is rather strange. Kindly help out at the earliest

Thanking you
Manish Kumar Deshpande

Please, note, that the

var mySidebar //in your js

is not equal to

mysidebar //in your php

JS is case sensitive.

If the problem still occurs for you please, provide a complete demo, where the problem can be checked locally.