Sử dụng TinyMCE, iBrowser với CakePHP

Sử dụng TinyMCE, iBrowser với CakePHP

TinyMCE

Cài đặt

+ Download TinyMCE http://tinymce.moxiecode.com/download.php

+ Sau khi download giải nén ra thư mục TinyMCE, và  copy nguyên thư mục /tiny_mce vào /webroot/js trong cakephp.

Cấu hình

+ Đưa đoạn mã vào layout  (hoặc vào view nếu không muốn sử dụng mặc định cho tất cả các layout) :

<?php
if(isset($javascript)):
echo $javascript->link('tiny_mce/tiny_mce.js');
endif;
?>

+ Khai báo sử dụng javascript helper trong Controller:

var $helpers = array('Javascript' );

+ Sử dụng

<script type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
convert_urls : false
});
</script> 

* mode : "textareas" Tất cả các textarea sẽ biến thành tinyMCE editor

iBrowser

Cài đặt

+ Download the ibrowser plugin from http://j-cons.com/downloads/

+ Copy into folder /tiny_mce/plugins/

Cấu hình

+ Cấu hình file config.inc.php trong folder config  dòng 96 :

$cfg['ilibs'] = array (
array (
'value' => '/bitcms/app/webroot/img/uploads/,
'text'        => 'Site Pictures',
),

...
);

* #dd0000;">'value' => #dd0000;">'/bitcms/app/webroot/img/uploads/ Đường dẫn tới folder chứa ảnh.

+  Copy file tinyMCE.editor_plugin.js từ folder interface trong folder ibrowser tới folder chính ibrowser và đổi tên thành editor_plugin.js

+ Khai báo  plugin ibrowser và include ibrowser button.

<script type="text/javascript">
tinyMCE.init({
plugins : "ibrowser",
 theme : "advanced",
 theme_advanced_buttons3_add : "ibrowser",
mode : "textareas",
convert_urls : false
});
</script>

 * Error: ib is undefined

khai báo biến ib trong file editor_plugin.js :

var ib = null;

* Thay đổi trang index trong ibrowser thành trang  Insert .

Sửa file ibrowser.php thêm code sau dưới dòng 129 (  btnStage(); )

/*
imDiv that contain adv content
call changeClass(0,'imDiv','hideit'); to hide  adv content
*/
changeClass(0,'imDiv','hideit');

/*
inDiv that contain insert form
call changeClass(0,'inDiv','showit'); to showit
*/
changeClass(0,'inDiv','showit');
Tags: 
Bạn thấy bài viết này như thế nào?: 
Average: 10 (1 vote)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Hướng dẫn tạo 1 Personalized Content Feeds trong Drupal 7

Hướng dẫn tạo 1 Personalized Content Feeds trong Drupal 7

One of our members wanted to allow users to create customized information feeds in Drupal. In this tutorial, we'll show you how to do that. We'll demonstrate how to allow users to view only certain types of content.

Hacker

Hacker có thể “tiêu diệt” Facebook vào ngày 5/11

Vào giữa tháng 8, cộng đồng mạng trở nên hốt hoảng trước thông tin hacker phát động chiến dịch đánh sập Facebook vào ngày 5/11.

Những vấn đề basic của Drupal 8 tại DrupalCon Austin

Những vấn đề basic của Drupal 8 tại DrupalCon Austin

To figure that out, I've mined the schedule for Drupal 8 related talks and events and organized them a bit to help me – and hopefully you – find the Drupal 8 sessions not to be missed.

Công ty diệt chuột T&C

 

Diet con trung