Joomla Developer

จาก Wiki2

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

This is to prepare to be Joomla Extensions Developer

เนื้อหา

Extension defined

for 1.5

  • Plugin is formarly know as Mambots, it response to Joomla event
  • Template is change the way site look
  • Module : for page rendering known as "boxes" Module are assigned per menu item and may call component.
  • Component: it is mini application with front and back end.

For 1.6 up

  • Library

Joomla Framework

Joomla เป็น PHP4 ไม่ใช่ PHP5 แต่สามารถพัฒนา Extension ด้วย PHP5 ได้ แต่ต้องคำนึงถึงข้อจำกัดของ PHP4 เวลาทำงานกับ Framework

Name Conventions

We'll start by looking some naming conventions.

  • Class names should start with an uppercase letter.
  • All named elements should use the camelCase standard.
  • Method names should start with a lowercase letter.
  • Non-public elements should start with an underscore.

Class Creation

Class ทุก Class ที่จะสร้างจะต้อง inherit จาก JOject เท่านั้นเพื่อให้รองรับการทำงานพื้นฐานของ Joomla และต้องไม่ลืมที่จะ Call constructor ของ JOject (Parent class) ด้วยนะครับดังตัวอย่าง

/**
  * Some Class which extends JObject
  */
class SomeClass extends JObject
{
     /**
      * Object name
      * @var string
      */
     var $name;
     /**
      * PHP 5 style Constructor
      *
      * @access	 protected
      * @param string name
     */
  function __construct($name)
  {
       $this->name = $name;
       parent::__construct();
  }
}

PHP 4 doesn't call constructors of the base class automatically from a constructor of a derived class. It is your responsibility to propagate the call to constructors upstream where appropriate.

Don't stop with die()

Reff: http://docs.joomla.org/Do_not_use_die_to_debug

เพราะ Joomla เก็บ State ไว้ใน Database จะต้องจบเป็นลำดับดังนี้

echo 'Test';
$mainframe->close();
/*
or use:
jexit();
*/
  
or 

function stop($msg = '')
{
    global $mainframe;
    echo $msg;
    $mainframe->close();
  /*
Alternative:
echo $msg;
jexit();
*/
}


Create Template

Document

Link

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