Forum closed. New forum available at

WYM_INIT_DIALOG is not defined and mod_rewrite

Support forum for WYMeditor.

WYM_INIT_DIALOG is not defined and mod_rewrite

Postby pcdinh on Sat Dec 22, 2007 2:13 pm

Hi all,

We all know that default Wymeditor's dialog windows may refuse to work when using it with a mod_rewrite-enabled web application. Unfortunately, almost modern PHP web applications that are built with SEO in mind (such as with Zend Framework, CakePHP, Symfony, SolarPHP...) all go with fake URLs or conventional URLs. That practice leads to heavy use of <base> tag. The fact that Wymeditor does not know it makes some editor's functions refuse to work in some cases such as images dialog windows... You should get WYM_INIT_DIALOG is not defined error in FireBug windows each time you were trying to open an image dialog windows or any kind of such an action.

After playing with Wymeditor this afternoon to integrate Wymeditor into my PHP framework, I found that I could configure Wymeditor to make it behave nicely with SEO-friendly URL by redeclaring dialogHtml:

Code: Select all
<script type="text/javascript">

jQuery(document).ready(function() {


      dialogHtml:  "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'"
                   + " ''>"
                   + "<html><head><base href=\""+$('base')[0].href+"\" />"
                   + "<link rel='stylesheet' type='text/css' media='screen'"
                   + " href='"
                   + WYM_CSS_PATH
                   + "' />"
                   + "<title>"
                   + WYM_DIALOG_TITLE
                   + "</title>"
                   + "<script type='text/javascript'"
                   + " src=\""+ WYM_JQUERY_PATH + "\"\><\/script>"
                   + "<script type='text/javascript'"
                   + " src='"
                   + WYM_WYM_PATH
                   + "'><\/script>"
                   + "</head>"
                   + WYM_DIALOG_BODY
                   + "</html>"


Now Wymeditor will add <base ..> tag to each dialog windows it opens. The attribute assigned to that base tag will be automatically extracted from the parent window.

Happy coding.

Posts: 3
Joined: Sat Dec 22, 2007 1:56 pm

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests