Welcome Guest, Not a member yet? Register   Sign In
tinymce.js source
#1

[eluser]Unknown[/eluser]
hello guys,
i am new to codeigniter, and i have some trouble installing tinymce in my website.
at the beginning, i tried to work on localhost, and the tinymce work well...

i am using a helper (name is : a_helper.php) to integrate the tinymce into the view page,
which code looks like this :

Code:
if (!defined('BASEPATH')) exit('No direct script access allowed');
function initialize_tinymce()
{
$tinymce = <- script type="text/javascript" src="http://localhost/js/tinymce/tiny_mce.js"><- /script ->
<- script type="text/javascript" ->
tinyMCE.init({
theme : "advanced",
mode : "textareas",
theme_advanced_toolbar_location : "top",
convert_urls : false,
height: 300,
width:700
});
<- /script ->';
return $tinymce;
}

the controller was :
Code:
class controlphoto extends CI_Controller
{
  function _construct()
  {
   parent::_construct();
  }
  
  function index()
  {
   $this->load->helper('url');
   $this->load->helper('a');
   $this->load->database();
   $this->load->model('watermark','',true);
   $this->load->model('category','',true);
   $data['watermark'] = $this->watermark->get_data();
   $data['category'] = $this->category->get_data();
  
   $this->load->view('pages/viewphoto',$data);
  }

and the view was :
Code:
&lt;html&gt;

&lt;head&gt;
&lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;

&lt;title&gt;test&lt;/title&gt;

&lt;?php echo initialize_tinymce();?&gt;
&lt;/head&gt;

&lt;body role="application"&gt;
&lt;form method="post" action="/gorga-12/storephoto" enctype="multipart/form-data"&gt;

&lt;!--some form element !--&gt;
Description : &lt;textarea&gt;/textarea>
&lt;!--some form element !--&gt;
&lt;/form&gt;
&lt;/body&gt;

everything went well, and the tinymce works just fine, but the trouble comes up when i tried to upload the site into my online webserver.

i already change the code in a_helper.php into something like this :

Code:
$tinymce = '<- script type="text/javascript" src="http://my_website_name/js/tinymce/tiny_mce.js" ->
//the rest of the code

but the tinymce just can't work. i think it's because the tiny_mce.js can't be located properly.

anybody can help me?
i also tried to use the base_url() from url helper, and make the source something like this:

Code:
$tinymce = '<- script type="text/javascript" src="http://'. base_url() .' js/tinymce/tiny_mce.js" ->
//the rest of the code

with my base url set up as http://my_website_name/ at config.

also i used the autoload.php in config to load my a_helper.php,

can anybody please tell me what went wrong Sad
#2

[eluser]mrh[/eluser]
Well I'm new too but I'm not having trouble loading JS... But your use of base_url() seems wrong. I think it should be just:

Code:
base_url() js/tinymce/tiny_mce.js

IE for me base_url() contains all of the required HTTP prefixing. Also in your config.php have you defined $config['base_url']? This should be the reference to your site as in:

Code:
$config['base_url'] = 'http://www.mysite.com/';
#3

[eluser]InsiteFX[/eluser]
Code:
&lt;?php echo base_url('js/tinymce/tiny_mce.js'); ?&gt;
#4

[eluser]Unknown[/eluser]
thank you all, my problem solved,
it was just like insiteFX said, i use
<code>
base_url('js/tinymce/tinymce.js')
</code>




Theme © iAndrew 2016 - Forum software by © MyBB