Welcome Guest, Not a member yet? Register   Sign In
Problem with tinymce integration
#1

[eluser]Michal1[/eluser]
Hello,

I have been trying to integrate tinymce wysiwyg into all textareas on my website, but I still cannot figure out why it does not work. I read all post about tinymce on this forum and have followed all steps.

I created a file default.js in js folder where tinymce is located and inside this file I have

Code:
<?php

function initMCE() {
  tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    //plugins : "style,table,advimage,advlink,emotions,iespell,preview,media,contextmenu,paste,directionality,noneditable,advlist",
    plugins : "table,preview",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,link,unlink,image,|,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,|,sub,sup",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,

    // Example content CSS (should be your site CSS)
    content_css : "css/content.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",
  });  
  

?>

Then in my view where I have textareas I have:

Code:
<html>

<head>

< script type="text/javascript" src="<?php echo base_url()?>js/tiny_mce/tiny_mce.js" >< /script>
< script type="text/javascript" src="<?php echo base_url()?>js/default.js">< /script >
< script language="Javascript" >
  initMCE();
< /script >  



  
&lt;/head&gt;

&lt;body&gt;
<H2> Write an article </H2>

&lt;?php echo form_open('administrace/create_article'); ?&gt;

<p> <label for= "title">  Title: </label>

&lt;input type="text" name="title""  id="title"" size="40"&gt;

</p>

<p>
    

    <label for = "content"> Content: </label>
    &lt;textarea rows="20" cols="80" name="content" &gt;   &lt;/textarea&gt;
    
    </p>
    
    <p>
        
        &lt;input type="submit" value="Add content"/&gt;
        
        
        <php echo form_close(); ?&gt;
            
            &lt;/body&gt;
            
            &lt;/html&gt;

But when I reload my page the tinymce is still not there. Anyone has any idea why?

Thank you very much
#2

[eluser]cideveloper[/eluser]
First thing I would do is move all your javascript calls to the bottom of your page above the closing body tag like below.

Code:
<php echo form_close(); ?&gt;
&lt; script type="text/javascript" src="&lt;?php echo base_url()?&gt;js/tiny_mce/tiny_mce.js" &gt;&lt; /script>
&lt; script type="text/javascript" src="&lt;?php echo base_url()?&gt;js/default.js"&gt;&lt; /script >
&lt; script language="Javascript" &gt;
  initMCE();
< /script >  
&lt;/body&gt;
&lt;/html&gt;

Secondly, why does your javascript file default.js have php open and close tags.
#3

[eluser]Michal1[/eluser]
Hi sorry for &lt;?php in default.js That was a mistake and of course I do not have those tags inside.

I have moved script above the ending body tag but it wysiwyg still does not show :/ Do not really see where is the problem.
#4

[eluser]Michal1[/eluser]
Btw, just to be sure. I am sending an attachment, where you can see how my folders look like.
#5

[eluser]Michal1[/eluser]
Just thinking, could there be a problem with htaccess? I have not created any so...
#6

[eluser]Unknown[/eluser]
Попробуй поправить htaccess, считаю что проблема в нем, либо в самомо интеграторе.
#7

[eluser]Michal1[/eluser]
I am sorry I do not speak Russian...
#8

[eluser]Mutsop[/eluser]
Just to be sure

when you have your webpage in front of you and check the source, what does the head links (.js path) say?
#9

[eluser]Michal1[/eluser]
Hi Mutstop: this is my head in source view

Code:
&lt; head&gt;

            &lt; script type="text/javascript" src="http://127.0.0.1:8888/novy_projekt/js/tiny_mce/tiny_mce.js"&gt;&lt; /script >
&lt; script type="text/javascript" src="http://127.0.0.1:8888/novy_projekt/js/default.js" &gt;&lt; /script >
&lt; script language="Javascript" &gt;
  initMCE();
< /script >  

  
< /head>
#10

[eluser]cideveloper[/eluser]
Can you try this.

Code:
<php echo form_close(); ?&gt;
&lt; script type="text/javascript" src="&lt;?php echo base_url()?&gt;js/tiny_mce/tiny_mce.js" &gt;&lt; /script>
&lt; script type="text/javascript" src="&lt;?php echo base_url()?&gt;js/default.js"&gt;&lt; /script >
&lt; script language="Javascript" &gt;
tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
});
< /script >  
&lt;/body&gt;
&lt;/html&gt;




Theme © iAndrew 2016 - Forum software by © MyBB