Jumi Study Note

จาก Wiki2

ข้ามไปที่: นำทาง, สืบค้น

เนื้อหา

Jumi Limitation

Jumi - Jack of all the trades?

  • Jumi plugin has memory limitations.

Jumi plugin (not Jumi module nor component) uses php buffering: the stored script is buffered into the memory first and then included into the article. For huge, really huge, scripts the memory_limit that is set in your php.ini may be insufficient. If so then increase it.

Security

NEVER forget to start your Joomla! php code with following lines! Never! They are very important for security reasons!

<?php
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );
?>

Concise Guide to Jumi

Don't forget to use Joomla Framework to reduce your code

Jumi Plugin

Insert the plugin code in the article content as following Syntax

{jumi [stored_code_source] [arg1] [arg2] ... [argN]}

where

  • stored_code_source

can be either a pathname to the file or *ID (e.g. *1) of the Jumi component database record. The pathname is the relative pathname of the file to be included with respect to the Default Absolute (Jumi) Path. The Default Absolute (Jumi) Path is identical to Joomla! root (unless it is manually specified in the plugin/module parameters in the admin backend.

  • arg1, arg2, ..., argN

are any number of optional Jumi arguments. It depends on your script if it takes Jumi arguments or it doesn't.

Example:

  • {jumi [images/codes/test.php]} //includes test.php file located in images/codes
  • {jumi [*1]} //includes code stored in the 1st record of Jumi component database table
  • {jumi area calc [test.php] width[4] height[6]} //includes test.php file and fills $jumi array

ตัวอย่าง Code test.php

<?php
	echo "Hello Khun  ".$jumi[0]." at ".$jumi[1];
?>

หากเก็บ Code ข้างบนนี้ ไว้ใน file ชื่อ test.php ที่ Root directory ของ Joomla web Directory "wwwroot/joomla/test.php"

ให้แทรก {jumi [test.php] [Jeeradate] [59] } เขียนใส่ไว้ใน content โดยใส่ใน Text editor โดยตรงไม่ใช่ html mode

หากเก็บ Code ไว้ใน file ชื่อ test.php ที่ Directory "wwwroot/joomla/jumicode/test.php"

ให้แทรก {jumi [jumicode/test.php] [Jeeradate] [59] }

จะได้ Out put = Hello Khun Jeeradate at 59

สามารถแทรกคำอธิบายโดยไม่มีผลกับการทำงานได้ แต่ต้องไม่ลืมคำว่า "{jumi" ดังตัวอย่าง

{jumi test plugin code in [jumicode/test.php] your name [Jeeradate] your age [59] }

Code File เป็น html ก็ได้นะครับ

Jumi Module

สามารถเลือก Jumi Module แล้วเลือก Copy เพื่อสร้าง Module เพิ่มได้เรื่อยๆ

Code ก็เหมือนกับ Plugin จะเขียนใน Module เองหรือเขียนเป็น File ก็ได้

ใส่ Code file name โดยไม่ต้องมี [ ] วงเล็บ แต่ยังไม่รู้วิธีใส่ Parameter

Jumi Component

สร้างง่ายกว่า Module คลิก Component>Jumi จากนั้น Add New ใส่ Code ก็เสร็จ

Tutorial

รับข้อมูลจาก "http://www.noklek.com/wiki2/index.php/Jumi_Study_Note"
เครื่องมือส่วนตัว