2013-05-31 36 views
1

enter image description here图像丢失OpenWYSIWYG编辑器,代码点火器结构

这正是发生在openWYSIWYG编辑器使用CodeIgniter。

的文件夹结构是这样的

app_name 
-application 
-assets 
--js 
---openwysiwyg 
----addons 
----docs 
----images 
----scripts 

这是我的看法文件:

<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> 

素文字鉴于:

<script type="text/javascript"> 
    WYSIWYG.attach('body_input', full); 

</script> 

我真的不知道缺什么。

回答

2

问题出在wysiwyg-settings.js文件中。该文件位于openwysiwyg/scripts/文件夹中。您必须更改图像和CSS目录的设置。检查这些行:

//full.ImagesDir = "images/"; 
//full.PopupsDir = "popups/"; 
//full.CSSFile = "styles/wysiwyg.css"; 

更改与此这些线(根据您的目录结构):

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"; 

现在它应该工作是应该的方式。

您可能遇到的另一个问题是,它不适用于Chrome。 (刚刚发生在我身上)解决方案是here

+0

,将尽快测试并回复。谢谢 –

+0

full.ImagesDir =“/ app_name/assets/js/openwysiwyg/images /”;您的解决方案需要进行一些修改。 –

+0

图标问题现在已修复。现在有内联图像问题。无法插入图片上传。 –

0

我在codeigniter中也遇到同样的问题。 有一个比这个更好的编辑器CKEditor也提供了上传图像的非常好的性能。
步骤:
1.Download的CKEditor从http://ckeditor.com/download
2.put它3.使用此语法笨
的索引目录中的标头:

<script type="text/javascript" src="<?php echo $this->config->item('base_url'); ?>/ckeditor/ckeditor.js"></script> 

4.使用这个身体要在位编辑器:

<textarea name="n_notification" id="n_notification"></textarea> 

5.使用此启动:

<script> 
$(document).ready(function() { 
    CKEDITOR.replace('n_notification'); 
} 
</script> 

如果您需要图片上传器,可以参考http://dwij.co.in/ckeditor-ckfinder-integration-using-php/将CKEditor与CKFinder(文件浏览器)集成在一起。

+0

CK编辑器不错,但图片上传功能非常昂贵,我觉得自己被骗了。即将做的 –