Technote Details :: Working with KTML and Dreamweaver Templates

Issue

When using KTML and pages generated using KTML templates, due to the fact that the control must add code in the Head section of the page some problems might arise.
 

Reason

This technical note covers two cases:

  1. You have a site that uses Dreamweaver templates and only one KTML control on a page.
  2. You have a site that uses Dreamweaver templates and more than one KTML control on a page.

One KTML control per page

If you create a page using Dreamweaver templates and apply the KTML server behaviour, the <head> tag is matched correctly, and all code is inserted in the right place. You do not have to change anything in order for the page to function.

Solution

More than one KTML control per page

Applying the first KTML control on the page works without error. Subsequent controls that are applied on the same page however will fail to properly match the <head> tag and will insert the code needed to configure the control inside the <body> tag, right at the start of the editable area. To correct this and use the KTML controls you have to:

  1. Open the page that has more than one KTML control applied and switch to code view.
  2. Locate the code that has been misplaced. It will start with a InstanceBeginEditabletag which is not in the <head> section of the page, and looks similar to the code below:

    <!-- InstanceBeginEditable name="EditRegion3" -->
    <script type="text/javascript">
        textfield2_config = {
    Note: textfield2 is the name of the second KTML control in this example.

  3. You have to move all of the KTML added code to the head section, after the one that creates the first control. The code to move right before the </head> tag is similar to the one below:

    <script type="text/javascript">
        textfield2_config = {
            "width": 450,
            "height": 350,
            "show_toolbar": "load",
            "show_pi": true,
            "background_color": "",
            "strip_server_location": false,
            "auto_focus": true,
            "module_props": { },
            "buttons": [
                [1, "standard", ["cut", "copy", "paste", "undo", "redo", "find_replace", "toggle_visible", "spellcheck", "toggle_editmode", "toggle_fullscreen", "help"]],
                [1, "formatting", ["bold", "italic", "underline", "align_left", "center", "align_right", "justify", "numbered_list", "bulleted_list", "outdent", "indent", "clean_menu", "foreground_color", "background_color", "superscript", "subscript"]],
                [2, "styles", ["heading_list", "style_list", "fonttype_list", "fontsize_list"]],
                [2, "insert", ["insert_link", "insert_anchor", "insert_table", "insert_image", "insert_file", "insert_template", "horizontal_rule", "insert_character"]],
                [3, "form", ["insert_form", "insert_textfield", "insert_hiddenfield", "insert_textarea", "insert_checkbox", "insert_radiobutton", "insert_listmenu", "insert_filefield", "insert_button", "insert_label", "insert_fieldset"]]
            ]
        };
        <?php
            $ktml_textfield2 = new ktml4("textfield2");
            $ktml_textfield2->setModuleProperty("filebrowser", "AllowedModule", "true", false);
            $ktml_textfield2->setModuleProperty("filebrowser", "MaxFileSize", "1024", true);
            $ktml_textfield2->setModuleProperty("filebrowser", "RejectedFolders", "", false);
            $ktml_textfield2->setModuleProperty("file", "UploadFolder", "uploads/files/", false);
            $ktml_textfield2->setModuleProperty("file", "UploadFolderUrl", "uploads/files/", true);
            $ktml_textfield2->setModuleProperty("file", "AllowedFileTypes", "doc, pdf, csv, xls, rtf, sxw, odt", true);
            $ktml_textfield2->setModuleProperty("media", "UploadFolder", "uploads/media/", false);
            $ktml_textfield2->setModuleProperty("media", "UploadFolderUrl", "uploads/media/", true);
            $ktml_textfield2->setModuleProperty("media", "AllowedFileTypes", "bmp, mov, mpg, mp3, avi, mpeg, swf, wmv, jpg, jpeg, gif, png", true);
            $ktml_textfield2->setModuleProperty("templates", "AllowedModule", "true", false);
            $ktml_textfield2->setModuleProperty("templates", "UploadFolder", "uploads/templates/", false);
            $ktml_textfield2->setModuleProperty("xhtml", "AllowedModule", "true", false);
            $ktml_textfield2->setModuleProperty("xhtml", "xhtml_view_source", "true", true);
            $ktml_textfield2->setModuleProperty("xhtml", "xhtml_save", "true", true);
            $ktml_textfield2->setModuleProperty("spellchecker", "AllowedModule", "true", false);
            $ktml_textfield2->setModuleProperty("css", "PathToStyle", "includes/ktm/styles/KT_styles.css", true);
            $ktml_textfield2->setModuleProperty("hyperlink_browser", "ServiceProvider", "includes/ktm/hyperlink_service.php", true);
            $ktml_textfield2->Execute();
        ?>
    </script>

  4. Save the page and reload it in the browser. The KTML controls should load properly, without any errors.
     

Home > Support > Knowledge Base > Technote Details
Search the Knowledge Base
© Adobe Systems Romania. All rights reserved.