Page 1 of 1

TinyMCE & Nextensio

Posted: 2011-03-09 03:27
by Timespider
Hi Fred.
This isn't totally an interakt problem, but for the life of me I can't get tinyMCE to work with nextensio. I've been mucking around with it (tinyMCE) & got it to install on the basic form. In my site root I have a folder called Tiny Mice with the src files in there, & this test page is in the site root also, here's the code

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
<head> 
<title>TinyMCE Test</title> 
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
 
<!-- tiny_mce.js PATH --> 
<script type="text/javascript" src="../Tiny Mice/tiny_mce.js"></script> 
<script type="text/javascript"> 
tinyMCE.init({ 
        mode : "textareas", 
        theme : "advanced", 
        plugins : "emotions,spellchecker,advhr,insertdatetime,preview",  
                 
        // Theme options - button# indicated the row# only 
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect", 
        theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,|,code,preview,|,forecolor,backcolor", 
        theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,charmap,emotions",       
        theme_advanced_toolbar_location : "top", 
        theme_advanced_toolbar_align : "left", 
        theme_advanced_statusbar_location : "bottom", 
        theme_advanced_resizing : true 
}); 
</script>
<script type="text/javascript">
function previewWindow(id) {
        var win = window.open("", "PreviewWindow", "width=500,height=500,resizable=yes");
        var c = tinyMCE.get(id).getContent();                    
        if(win) {
            win.document.writeln("<html><head><link rel='stylesheet' type='text/css' href='replaceMeWithYourStyleSheet.css' /></head><body>" + c + "</body></html>");
        win.document.close();
    }
}
</script>
</head> 
<body> 
<!-- OF COURSE YOU NEED TO ADAPT ACTION TO WHAT PAGE YOU WANT TO LOAD WHEN HITTING "SAVE" --> 
<form method="post" action="show.php"> 
        <p>      
                <textarea name="content" cols="50" rows="15">This is some content that will be editable with TinyMCE.</textarea> 
                <input type="submit" value="Submit" /> 
        </p> 
</form> 
 
<p>&nbsp;</p>
<form id="form1" method="post" action=""><input type="button" id="previewButton" value="Preview content before submitting it" onclick="javascript:previewWindow('content');"></input>
</form>
<p>&nbsp;</p>
</body> 
</html>
Now when I try to do this on a nextensio form I can't get it to work. The form is located at root/Admin/articles/form which is why the path is different. here's the code for that.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/adminTrackeyKids.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<script type="text/javascript" src="../../Tiny Mice/tiny_mce.js"></script> 
<script type="text/javascript"> 
tinyMCE.init({ 
        mode : "textareas", 
		theme : "advanced", 
        plugins : "emotions,spellchecker,advhr,insertdatetime,preview",
                 
        // Theme options - button# indicated the row# only 
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect", 
        theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,|,code,preview,|,forecolor,backcolor", 
        theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,charmap,emotions",       
        theme_advanced_toolbar_location : "top", 
        theme_advanced_toolbar_align : "left", 
        theme_advanced_statusbar_location : "bottom", 
        theme_advanced_resizing : true 
}); 
</script>
<script type="text/javascript">
function previewWindow(id) {
        var win = window.open("", "PreviewWindow", "width=500,height=500,resizable=yes");
        var c = tinyMCE.get(id).getContent();                    
        if(win) {
            win.document.writeln("<html><head><link rel='stylesheet' type='text/css' href='replaceMeWithYourStyleSheet.css' /></head><body>" + c + "</body></html>");
        win.document.close();
    }
}
</script>

---------------------------------------------
//AND THE FORM BELOW
---------------------------------------------
<form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" enctype="multipart/form-data">
                  <?php $cnt1 = 0; ?>
                  <?php do { ?>
                    <?php $cnt1++; ?>
                    <?php 
// Show IF Conditional region1 
if (@$totalRows_rsarticles_art > 1) {
?>
                      <h2><?php echo NXT_getResource("Record_FH"); ?> <?php echo $cnt1; ?></h2>
                      <?php } 
// endif Conditional region1
?>
                    <table cellpadding="2" cellspacing="0" class="KT_tngtable">
                      <tr>
                        <td class="KT_th"><label for="title_art_<?php echo $cnt1; ?>">Title:</label></td>
                        <td><input type="text" name="title_art_<?php echo $cnt1; ?>" id="title_art_<?php echo $cnt1; ?>" value="<?php echo KT_escapeAttribute($row_rsarticles_art['title_art']); ?>" size="32" maxlength="250" />
                            <?php echo $tNGs->displayFieldHint("title_art");?> <?php echo $tNGs->displayFieldError("articles_art", "title_art", $cnt1); ?> </td>
                      </tr>
                      <tr>
                        <td class="KT_th"><label for="date_art_<?php echo $cnt1; ?>">Date:</label></td>
                        <td><input type="text" name="date_art_<?php echo $cnt1; ?>" id="date_art_<?php echo $cnt1; ?>" value="<?php echo KT_formatDate($row_rsarticles_art['date_art']); ?>" size="10" maxlength="22" />
                            <?php echo $tNGs->displayFieldHint("date_art");?> <?php echo $tNGs->displayFieldError("articles_art", "date_art", $cnt1); ?> </td>
                      </tr>
                      <tr>
                        <td class="KT_th"><label for="article_art_<?php echo $cnt1; ?>">Article:</label></td>
                        <td><textarea  name="article_art_<?php echo $cnt1; ?>" id="article_art_<?php echo $cnt1; ?>"cols="50" rows="5"><?php echo KT_escapeAttribute($row_rsarticles_art['article_art']); ?></textarea>
                          <?php echo $tNGs->displayFieldHint("article_art");?> <?php echo $tNGs->displayFieldError("articles_art", "article_art", $cnt1); ?> </td></tr>
                      <tr>
                        <td class="KT_th"><label for="image_art_<?php echo $cnt1; ?>">Image:</label></td>
                        <td><input type="file" name="image_art_<?php echo $cnt1; ?>" id="image_art_<?php echo $cnt1; ?>" size="32" />
                            <?php echo $tNGs->displayFieldError("articles_art", "image_art", $cnt1); ?> </td>
                      </tr>
                      <tr>
                        <td class="KT_th"><label for="category_art_<?php echo $cnt1; ?>">Category:</label></td>
                        <td><select name="category_art_<?php echo $cnt1; ?>" id="category_art_<?php echo $cnt1; ?>">
                            <option value=""><?php echo NXT_getResource("Select one..."); ?></option>
                            <?php 
do {  
?>
                            <option value="<?php echo $row_rsCategory['id_cat']?>"<?php if (!(strcmp($row_rsCategory['id_cat'], $row_rsarticles_art['category_art']))) {echo "SELECTED";} ?>><?php echo $row_rsCategory['category_cat']?></option>
                            <?php
} while ($row_rsCategory = mysql_fetch_assoc($rsCategory));
  $rows = mysql_num_rows($rsCategory);
  if($rows > 0) {
      mysql_data_seek($rsCategory, 0);
	  $row_rsCategory = mysql_fetch_assoc($rsCategory);
  }
?>
                          </select>
                            <?php echo $tNGs->displayFieldError("articles_art", "category_art", $cnt1); ?></td>
                      </tr>
                    </table>
                    <input type="hidden" name="kt_pk_articles_art_<?php echo $cnt1; ?>" class="id_field" value="<?php echo KT_escapeAttribute($row_rsarticles_art['kt_pk_articles_art']); ?>" />
                    <?php } while ($row_rsarticles_art = mysql_fetch_assoc($rsarticles_art)); ?>
                  <div class="KT_bottombuttons">
                    <div>
                      <?php 
      // Show IF Conditional region1
      if (@$_GET['id_art'] == "") {
      ?>
                        <input type="submit" name="KT_Insert1" id="KT_Insert1" value="<?php echo NXT_getResource("Insert_FB"); ?>" />
                        <?php 
      // else Conditional region1
      } else { ?>
                        <div class="KT_operations">
                          <input type="submit" name="KT_Insert1" value="<?php echo NXT_getResource("Insert as new_FB"); ?>" onclick="nxt_form_insertasnew(this, 'id_art')" />
                        </div>
                        <input type="submit" name="KT_Update1" value="<?php echo NXT_getResource("Update_FB"); ?>" />
                        <input type="submit" name="KT_Delete1" value="<?php echo NXT_getResource("Delete_FB"); ?>" onclick="return confirm('<?php echo NXT_getResource("Are you sure?"); ?>');" />
                        <?php }
      // endif Conditional region1
      ?>
                      <input type="button" name="KT_Cancel1" value="<?php echo NXT_getResource("Cancel_FB"); ?>" onclick="return UNI_navigateCancel(event, '../../includes/nxt/back.php')" />
                    </div>
                  </div>
                </form>
Is there anything you can see that is preventing it from working. I didn't use editor_selector : as I just want it to pick up the one form. I also tried this on an existing KTML4 form using your instructions but no luck either.

Thanks Chris

Re: TinyMCE & Nextensio

Posted: 2011-03-10 16:45
by Fred
Chris,
I took your code, stripped out the php bits, update the tinymce path to fit my setup and it worked fine so I can only assume it is your path to tiny that is incorrect.

What I would suggest is to upload the test page to the same location as where the form is to make sure you have your path correct.

Re: TinyMCE & Nextensio

Posted: 2011-03-11 03:22
by Timespider
Hi Fred, I think the issue was the hosts server as he has told me today there has been lots of issues this week. I followed your suggestion with the test form, adjusted the path & it worked so copied that path to the nextensio form & it;s all working now. Just adding PHP spell check to it now http://www.phpspellcheck.com/

I thank you for your help, you are the light at the end of a sometimes dark tunel, especially for a guy like me who comes from a carpentry background.

Regards Chris

Re: TinyMCE & Nextensio

Posted: 2011-03-11 14:35
by Fred
I know the feeling, my background is aviation...

That phpspellcheck looks interesting will need to read up a bit on it.