What’s up?

I moved my blog to http://blog.hromnik.com/en/

I usually write about life, self-improvement, programming, startups,…

Advertisements

Elfinder itegration into TinyMCE4

This solution http://stackoverflow.com/questions/16016870/tinymce-4-with-elfinder did not work for me. I wanted to answer this thread but I don’t have enough reputation.

When you click on “Upload image”:

tinymce-img-upload

Tinymce will show “dialog.php” file in “tinymce/plugins/filemanager/dialog.php” by default. So copy Elfinder folder into “tinymce/plugins/” and rename the folder to “filemanager“. Rename “elfinder.html” to “dialog.php“. And rewrite options in “tinymce/plugins/filemanager/php/connector.php” like this:

$opts = array(
	// 'debug' => true,
	'roots' => array(
		array(
			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
			'path'          => '../img/',         // path to files (REQUIRED)
			'URL'           => dirname($_SERVER['PHP_SELF']) . '../../img/', // URL to files (REQUIRED)
			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
		)
	)
);

I changed ‘path‘ and ‘URL‘. It now shows images in “tinymce/plugins/filemanager/img/

I have TinyMCE in my www (root) folder and “uploads” folder too. So in my case I have

'path' => '../../../../uploads/'

and

'URL' => dirname($_SERVER['PHP_SELF']) . '../../../../../uploads/'

It works for me. For you it should work too.
If You have any problem with Elfinder, try this filemanager https://github.com/2b3ez/FileManager4TinyMCE

LESS.js – LESS variables does not work

Simple solution! I had included css file before I decided to use LESS so I just changed file css to less:

<link rel="stylesheet" type="text/css" href="css/style.less">
<script type="text/javascript" src="js/less.js"></script>

BUT, It did not work!

This worked:

<link rel="stylesheet/less" type="text/css" href="css/style.less">
<script type="text/javascript" src="js/less.js"></script>

U see difference? No? 😉

rel="stylesheet/less"