在 Yii 中使用 Elfinder 扩展 [英] Using Elfinder extension in Yii

查看:15
本文介绍了在 Yii 中使用 Elfinder 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在单击按钮时弹出的文件管理器中使用.我正在使用 Yii 扩展 elfinder.我发现很难理解使用它的方式.我从 bitbucket 下载了代码,将它放在我的应用程序中的文件夹扩展名中.我尝试使用新控制器对其进行测试,将其命名为 elfcontroller 并放入以下代码(从网站上获取)

I need to use a file manager in pop up which comes on a button click. I am using Yii extension elfinder. I am finding it hard to understand the way of using it. I downloaded the code from bitbucket, put it inside my application in the folder extension. I try to test it using new controller, named it elfcontroller and put the following code (got from the website)

class ElfinderController extends CController
{
public function actions()
{
    return array(
        'connector' => array(
            'class' => 'ext.elFinder.ElFinderConnectorAction',
            'settings' => array(
                'root' => Yii::getPathOfAlias('webroot') . '/uploads/',
                'URL' => Yii::app()->baseUrl . '/uploads/',
                'rootAlias' => 'Home',
                'mimeDetect' => 'none'
            )
        ),
    );
}
}

我又创建了一个函数来渲染索引页面(我希望文件管理器在这个页面中)

and i created one more function for rendering the index page(i want the file manager to be in this page)

在视图中我写了以下代码

in the view i wrote the following code

$model = new xxxmodel();
$this->widget('ext.elFinder.ElFinderWidget', array(
      'model' => $model,
      'attribute' => 'serverFile',
      'connectorRoute' => 'admin/elfinder/connector',
      )
  );

并且我包含了一个 div 来包含它

and i included a div for containing it

但是我收到以下错误

别名ext.elFinder.ElFinderWidget"无效.确保它指向现有的 PHP 文件并且该文件可读.

我试图在 config/main.php 中包含别名

i tried to include alias in config/main.php

我知道我弄乱了文件夹结构

I know i am messing some where with the folder structure

这是我使用扩展程序的路径C:\xampp\htdocs\project\protected\extensions\ext.elfinder

here is the path i am using the extension C:\xampp\htdocs\project\protected\extensions\ext.elfinder

我在谷歌搜索后返回空,谁能解释一下如何使用此扩展程序将代码准确放置在需要的位置?

I returned empty after google searches, can any one please explain me how to use this extension to place the code exactly where it is needed to be?

推荐答案

一般extensions文件夹已经有ext别名,所以不需要设置它的别名.

In general the extensions folder already has the ext alias, so you don't need to set an alias for it.

然后扩展本身应该放在 extensions 文件夹中,有点像: project/extensions/extension-name/ .在您的情况下,它应该是: project\extensions\elFinder ,并保持其余代码相同,即继续引用扩展名,如:

Then the extension itself should be placed in the extensions folder, somewhat like : project/extensions/extension-name/ . In your case it should be: project\extensions\elFinder , and keep the rest of your code same, i.e continue referring to extension like:

ext.elFinder.ElFinderWidget

这篇关于在 Yii 中使用 Elfinder 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆