Wednesday, October 14, 2009

Integrate tinyMCE with IMCE

# add this function to your current theme's template.php file.(create it if you don't have it.& put it into php clause )

function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {

static $access, $integrated;

if (!isset($access)) {

$access = function_exists('imce_access') && imce_access();


$init = theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running);

if ($init && $access) {

$init['file_browser_callback'] = 'imceImageBrowser';

if (!isset($integrated)) {

$integrated = TRUE;

drupal_add_js("function imceImageBrowser(fid, url, type, win) { +'?q=imce&app=TinyMCE|url@'+ fid, '', 'width=760,height=560,resizable=1');}", 'inline');



return $init;


# Go to admin/settings/performance and Clear cached data (at the bottom).
# Make sure your users have access to IMCE (admin/settings/imce)
# Clear your browser's cache and start testing.

No comments: