This is exactly what is happening to the openWYSIWYG editor with CodeIgniter.
The folder structure is like this
app_name
-application
-assets
--js
---openwysiwyg
----addons
----docs
----images
----scripts
This is my view file:
<script src="<?php echo base_url('assets/js/jquery.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/openwysiwyg/scripts/wysiwyg.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/openwysiwyg/scripts/wysiwyg-settings.js');?>"></script>
Scipt in view:
<script type="text/javascript">
WYSIWYG.attach('body_input', full);
</script>
I don't really know what is missing.
The problem is in the wysiwyg-settings.js
file. This file is located in the openwysiwyg/scripts/
folder. You have to change the settings for the image and CSS directory. Check for these lines:
//full.ImagesDir = "images/";
//full.PopupsDir = "popups/";
//full.CSSFile = "styles/wysiwyg.css";
Change these line with this (based upon your directory structure):
full.ImagesDir = "app_name/assets/js/openwysiwyg/images/";
full.PopupsDir = "app_name/assets/js/openwysiwyg/popups/";
full.CSSFile = "app_name/assets/js/openwysiwyg/styles/wysiwyg.css";
Now it should work the way it is supposed to.
Another problem that you may run into is that it will not work in Chrome. (That happened to me just now.) The solution is here.
I was also facing same problem in codeigniter.
There is one better editor than this called CKEditor also gives facility to upload Images with very good performance.
Steps:
1.Download CKEditor from http://ckeditor.com/download
2.put it in index directory of codeigniter
3.Use this syntax in header:
<script type="text/javascript" src="<?php echo $this->config->item('base_url'); ?>/ckeditor/ckeditor.js"></script>
4.Use this in body where you want to place editor:
<textarea name="n_notification" id="n_notification"></textarea>
5.Use this to initiate:
<script>
$(document).ready(function() {
CKEDITOR.replace( 'n_notification');
}
</script>
You can refer http://dwij.co.in/ckeditor-ckfinder-integration-using-php/ to integrate CKEditor with CKFinder(File Browser) if you want image uploader.