0

I use Elfinder and I want to integrate it. I use the namespace and elfinder return me this error below. I need to create a dynamic link depending host site.

Thak you

Invalid backend response.

Data is not JSON.
<br /> <b>Notice</b>: Undefined variable: OSCOM in <b>/home/www//boutique/includes/Core/Conf/ElFinderConfig.php</b> on line <b>11</b><br /> <br /> <b>Fatal error</b>: Uncaught Error:

Call to a member function getConfig() on null in /home/www//boutique/includes/Core/Conf/ElFinderConfig.php:11 Stack trace: #0 /home/www/boutique/ext/elfinder_2x/php/connector.minimal.php(71): require() #1 {main} thrown in /home/www/boutique/includes/Core/Conf/ElFinderConfig.php on line 11

In

minimal.connector.php

I inserted inside minimal.connector.php these elements and the require called DIR_FS_CATALOG_IMAGES and DIR_WS_CATALOG_IMAGES

require('../../../includes/Core/Conf/ElFinderConfig.php');

// Documentation for connector options: // https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options

$opts = array(
  'debug' => true,  //see a new menu in filefinder with all informations
  'roots' => array(
                    array(
                      'driver'        => 'LocalFileSystem',           // driver for accessing file system (REQUIRED)
                    //'path'          => '../files/',                 // path to files (REQUIRED)
//                    'path'          => '../../../sources/image/',         // path to files (REQUIRED)
//                    'URL'           =>  '../../../../boutique/sources/image/', // URL to files (REQUIRED)

                      'path'          =>  DIR_FS_CATALOG_IMAGES,         // path to files (REQUIRED)
                      'URL'           =>  DIR_WS_CATALOG_IMAGES, // URL to files (REQUIRED)

...

I changed this

            'path'          => '../../../sources/image/',         // path to files (REQUIRED)
            'URL'           =>  '../../../../boutique/sources/image/', // URL to files (REQUIRED)

by this

              'path'          =>  DIR_FS_CATALOG_IMAGES,         // path to files (REQUIRED)
              'URL'           =>  DIR_WS_CATALOG_IMAGES, // URL to files (REQUIRED)

and ElFinderConfig.php is write like this

<?php
  use ClicShopping\OM\OSCOM;

 define('DIR_FS_CATALOG_IMAGES',  OSCOM->getConfig('dir_root', 'Shop') . 'sources/image/');       // path to files (REQUIRED)
 define('DIR_WS_CATALOG_IMAGES',  OSCOM::getConfig('http_path', 'Shop'));       // path to files (REQUIRED)
Yoko
  • 27
  • 1
  • 7
  • $OSCOM, it's an error of mine, but with OSCOM->, it does'nt solve the problem. I think there maybe a cufision because elfinder use autoload also. I suppose – Yoko Oct 15 '16 at 21:29
  • You need to read about OOP. `OSCOM->getConfig()` could never work, because `->` means that you're accessing a property / method of an object and an object is an instance of a class. So, if `OSCOM` is the class, you would need something like `$oscom = new OSCOM();` and then you could use `$oscom->getConfig()`. If you don't want to create an object, you can access _static properties and methods_ using `::`. but the property or method needs to be created as static. – Luís Cruz Oct 15 '16 at 22:55

0 Answers0