.jpg)
วิธีเพิ่ม Tempalte ให้ TinyMCE WYSIWYG? ใน Joomla 1.5
ก่อนเพิ่ม มาทำความรู้จัก Tempalte ใน TinyMCE WYSIWYG?? กันก่อนนะครับ
Tempalte ใน TinyMCE WYSIWYG? คือรูปแบบที่เราจะกำหนด ขึ้น เพื่อทำเนื้อหาที่มีโครงสร้างแบบเดียวกัน
เช่นเราต้องการสร้างเนื้อหา ใน Joomla ที่มีลักษณะเหมือน กันทุกๆ หน้า เช่น
เป็นตารางกว้าง 3x10 ในทุกเนื้อหา เราก็สร้าง Tempalte ที่เป็นตารางเปล่าๆ ขึ้นมาเพื่อรอเอาข้อมูลใส่ลงไปในนั้นอีกที
วิธี
1. Login เข้าหน้า administrator >> Extensions >> Plugin Manager
2. คลิกที่ Editor - TinyMCE 2.0 >> Advanced Parameters
3. คลิก ถูกที่ Show ของ Template? เพื่อเป็นการบอกให้ Joomla รู้ว่า เราต้องการใช้ ระบบ Tempalte ใน TinyMCE WYSIWYG
4. FTP เข้าไปแก้ไข ไฟล์ /plugins/editors/tinymce.php
แก้ไข
?? ??? ?// template
?? ??? ?$template?? ??? ??? ?= $this->params->def( 'template', 0 );
?? ??? ?if ( $template ) {
?? ??? ??? ?$plugins[]?? ?= 'template';
?? ??? ??? ?$buttons3[]?? ?= 'template';
?? ??? ?}
เป็น
?? ??? ?// template
?? ??? ?$template_external_list_url ='';
?? ??? ?$template?? ??? ??? ?= $this->params->def( 'template', 0 );
?? ??? ?if ( $template ) {
?? ??? ??? ?$plugins[]?? ?= 'template';
?? ??? ??? ?$buttons3[]?? ?= 'template';
?? ??? ??? ?$template_external_list_url ='template_external_list_url : "'.JURI::root().'plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/external_list_url.js",';
?? ??? ?}
แก้ไข
?? ??? ?$element_path
?? ??? ?fullscreen_settings : {
?? ??? ??? ??? ?theme_advanced_path_location : "top"
?? ??? ??? ?}
เป็น
?? ??? ?$element_path
?? ??? ?$template_external_list_url
?? ??? ?fullscreen_settings : {
?? ??? ??? ??? ?theme_advanced_path_location : "top"
?? ??? ??? ?}
5.สร้างไฟล์ชื่อ external_list_url.js โดยมีรายละเอียดข้างใน ดังนี้
var tinyMCETemplateList = [
?? ?// Name, URL, Description
?? ?["ชื่อ Template1", "template_templates/Template1.htm", "Template1 HTML templates."],
?? ?["ชื่อ Template2", "template_templates/Template2.htm", "Template2 HTML templates."],
?? ?["ชื่อ Template3", "template_templates/Template3.htm", "Template3 HTML templates."]
];
Upload ไปไว้ที่ /plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/external_list_url.js
6. สร้าง folder template_templates ใน administrator
7. สร้างไฟล์ Template1.htm ,Template2.htm,Template3.htm ตามความต้องการ (สร้างด้วย Adobe Dreamweaver CS3 ก็ได้)
แล้ว Upload ไปไว้ที่ /administrator/template_templates/*
8. ถ้าไม่มีอะไรผิดพลาด ตอนที่เรา จัดการ Article ก็จะมี ปุ่ม Insert predefined template content เพิ่มขึ้นมาที่หน้าจอ จัดการบทความของเรา

