How To



  • Download latest release package from Yii extensions repository
  • Unpack it.
  • Copy fileeditor folder in /protected/extensions/
  • Copy FileeditorController.php file under protected/controllers/
  • Copy logFileEditor.txt in your root and make it writable. You can customize this filename and path, but you must change it name and path in FileeditorController. Here will be registered some informations about any ilegal attempt to access other files than files from your public folders.
  • For test, copy files folder in the root's site and make it writable. In production you can use any folders.
  • Important: In every writable folder add a .htaccess file, containing deny from all text.


In your editor page, insert next code and adjust it properly to your necessities.
Open FileeditorController and put same editableFolders as value for $editableFolders.
If someone know how this parameter could be imported from extension in controller, please let me know.

		$this->widget('application.extensions.fileeditor.fileeditor', array(
			'editableFolders'=>array(
					array('path'=>"files/css", 'label'=>'CSS'),
					array('path'=>"others/codes/personal", 'label'=>'PHP'),
					array('path'=>"protected/views/site/pages", 'label'=>'PAGES'),
			),
			'options'=>array(
				'name'=>'editor',
				'class'=>'editor',
				'editorwidth'=> '910', 
				'min_width'=>'910',
				'min_height'=>'500',
				'cols'=>100,
				'rows'=>30,
				'language'=>'en',
				'syntax'=> 'php',
				'allow_resize'=>'y',
				'is_editable'=>true,
				'word_wrap'=>'true',
				'allow_toggle'=>true,
				'start_highlight'=>true,
				'toolbar'=>'new, load, save, |, search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help',
				'plugins'=>'new',
				'load_callback'=> 'loadFileEditor',
				'save_callback'=> 'saveFileEditor',
				'EA_load_callback'=>'setEditorId',
				'EA_file_close_callback'=>'closeFileEditor',
				'is_multi_files'=> true
				)
			)
		);
	



  • editableFolders: a multidimensional array, which keep path and label for every editable folder.
    READ NEXT:
    For folder's path use relative paths to site root. Example: 'protected/views/site/pages' or files.
    Label of folder must be unique and without slash or backslash. For labels, use short and suggestive names.
    Important: In every writable folder you must add a .htaccess file, containing deny from all text to avoid external access to files.
    Don't expose your sensitive folders to public access. For public access you use custom folders in which everybody can change anything.

  • Don't forget to make folders writable.



  • name: id and name for textarea editor(change it only if there is another #editor element)
  • class: class for textarea editor(change it only if there is another .editor element)
  • editorwidth: width for editor (integer value without px)
  • min_width: minim width for editor (integer value without px)
  • min_height: minim height for editor (integer value without px)
  • cols: number of columns for textarea editor (integer value)
  • rows: number of rows for textarea editor (integer value)
  • language: language for editor. Available languages: bg, cs, de, dk, en, eo, es, fi, fr, hr, it, ja, mk, nl, pl, pt, ro, ru, sk, zn
  • syntax: default syntax for editor. Available syntaxes: basic, brainfuck, c, coldfusion, cpp, css, html, java, js, pas, perl, php, python, robotstxt, ruby, sql, tsql, vb, xml
  • allow_resize: permit editor to be resized. Available options: both, x, y
  • is_editable: set if editor is editabe or not(read-only)(boolean: true/false without quotes)
  • word_wrap: set if editor will use word wrap facility (boolean: true/false without quotes)
  • allow_toggle: add a checkbox to permit switch between editor and textarea (boolean: true/false without quotes)
  • start_highlight: set if editor use highlight as default (boolean: true/false without quotes)
  • toolbar: set toolbar elements
  • plugins: used to extend EditArea functionalities



  • load_callback: the callback used to load files
  • save_callback: the callback used to save files
  • EA_load_callback: the callback used when editor is loaded
  • EA_file_close_callback: the callback used when a file is closed
  • is_multi_files: set editor to accept more files to be opened at one time(boolean: true/false without quotes)


For more details about EditArea parameters visit official site: http://www.cdolivet.com.




To change users permissions, adjust settings in protected/controllers/FileeditorController.php, using Yii mode.