Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filemanager and Yii2 #3

Closed
logofakt opened this issue Dec 21, 2016 · 1 comment
Closed

Filemanager and Yii2 #3

logofakt opened this issue Dec 21, 2016 · 1 comment

Comments

@logofakt
Copy link

You may use it in Yii2 like this

In a controller call
public function fileman {
return $this->render('filemanager')
}

In views put filemanager.php.
At the top of the file put
use yii\helpers\Url;
define('FM_EMBED', true);
define('FM_LANG', 'en');
define('FM_SELF_URL', Url::base());

In your elfinder I created an issue, if you would have a look at it?

@alexantr
Copy link
Owner

alexantr commented Jan 3, 2017

One more example without view file:

/**
 * @return mixed
 * @throws ServerErrorHttpException
 */
public function actionFilemanager()
{
    $manager = Yii::getAlias('@app/tools/filemanager.php');
    if (!is_file($manager)) {
        throw new ServerErrorHttpException('"PHP File Manager" not found.');
    }

    Yii::$app->response->format = Response::FORMAT_RAW;

    error_reporting(E_ALL);

    define('FM_EMBED', true);
    define('FM_LANG', 'en');
    define('FM_SELF_URL', Url::canonical());

    ob_start();
    ob_implicit_flush(false);

    require $manager;

    return ob_get_clean();
}

I'm using this variant.

@alexantr alexantr closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants