Reputation: 416
I have a backend in Codeigniter. I am using TinyMCE.
I wrote a demo text and made it bold and added more text in the next line with different font family and font size.
The values getting saved in the database is as follows :
<code>
<p><strong>HELLO !!!</strong></p>
<p> </p>
<p><span 36pt; font-family: terminal, monaco;"><strong>Hello</strong></span></p>
So, When i echo this on the editor in the backend after saving , it does not reflect the font family and font size.
I tried using htmlentities() and html_entity_decode() but no use.
I need to echo
it in the backend editor and the front end page as well.
I am using the Codeigniter framework.
My controller function is something like this :
<code>
if($this->form_validation->run())
{
$page_data = array(
'content' => $this->input->post('description') ,
'page_id' => 2
);
$data['page_content'] = $this->Admin_model->get_jingles_about();
if(!empty($data['page_content']))
{
$edit = $this->Admin_model->jingles_about_edit($page_data);
$this->session->set_flashdata('success', 'Saved successfully');
}
else
{
$insert = $this->Admin_model->jingles_about_add($page_data);
$this->session->set_flashdata('success', 'Saved successfully');
}
redirect('admin/jingles_about');
}
Upvotes: 0
Views: 2171
Reputation: 8957
I am using TinyMCE 4.2.7
This is what I did to save font family, size, bold, underline, italics to save it to database.
Focus on plugins and toolbar1 --> fontselect fontsizeselect
tinyMCE.init({ selector: "#about", theme: "modern", plugins: [ "autolink lists link hr ", " wordcount ", " paste " ], toolbar1: "undo redo | fontselect fontsizeselect styleselect | bullist numlist | link", extended_valid_elements: 'a[href|target=_blank]', menubar:false, remove_trailing_brs: false, force_br_newlines : true, force_p_newlines : false, forced_root_block : '' });
Upvotes: 0
Reputation:
Perhaps you can save to database as bbcode instead of html. Later convert back to html after loading it into editor. TinyMCE have tools for that. Refer the documentation.
Upvotes: 0