• Selamat datang di CodeIgniter
  • Panduan Instalasi
    • Downloading CodeIgniter
    • Panduan Instalasi
    • Upgrade Dari Versi Sebelumnya
    • Penyelesaian Masalah
  • Ikhtisar CodeIgniter
    • Memulai dengan CodeIgniter
    • Sekilas Tentang CodeIgniter
    • Fitur yang Didukung
    • Alur Aplikasi
    • Model-View-Controller
    • Desain and Sasaran Arsitektur
  • Tutorial
    • Halaman Statis
    • Bagian Berita
    • Membuat Item Berita
    • Kesimpulan
  • Berkontribusi ke CodeIgniter
    • Menulis Dokumentasi CodeIgniter
    • Developer’s Certificate of Origin 1.1
  • Pembahasan Umum
    • CodeIgniter URLs
    • Controllers
    • Reserved Names
    • Views
    • Model
    • Helpers
    • Menggunakan Library CodeIgniter
    • Membuat Library
    • Using CodeIgniter Drivers
    • Membuat Driver
    • Membuat Class Inti Sistem
    • Membuat Class Tambahan
    • Hooks - Mengembangkan Inti Framework
    • Auto-loading Resources
    • Fungsi-fungsi Umum
    • Fungsi-fungsi Kompatibilitas
    • URI Routing
    • Penanganan Error
    • Caching
    • Profiling Aplikasi Anda
    • Menjalankan dengan CLI
    • Mengelola Aplikasi Anda
    • Handling Multiple Environments
    • Alternatif Syntax PHP untuk File View
    • Keamanan
    • PHP Style Guide
  • Referensi Library
    • Benchmarking Class
    • Caching Driver
    • Calendaring Class
    • Shopping Cart Class
    • Config Class
    • Email Class
    • Encrypt Class
    • Encryption Library
    • File Uploading Class
    • Form Validation
    • FTP Class
    • Image Manipulation Class
    • Input Class
    • Javascript Class
    • Language Class
    • Loader Class
    • Migrations Class
    • Output Class
    • Pagination Class
    • Template Parser Class
    • Security Class
    • Session Library
    • HTML Table Class
    • Trackback Class
    • Typography Class
    • Unit Testing Class
    • URI Class
    • User Agent Class
    • XML-RPC and XML-RPC Server Classes
    • Zip Encoding Class
  • Referensi Database
    • Quick Start: Contoh Penggunaan
    • Konfigurasi Database
    • Menghubungkan ke Database
    • Menjalankan Queries
    • Menampilkan Hasil Query
    • Fungsi-fungsi Query Helper
    • Query Builder Class
    • Transactions
    • Mendapatkan MetaData
    • Memanggil Custom Functions
    • Query Caching
    • Manipulasi Database dengan Database Forge
    • Database Utilities Class
    • Referensi Database Driver
  • Referensi Helper
    • Array Helper
    • CAPTCHA Helper
    • Cookie Helper
    • Date Helper
    • Directory Helper
    • Download Helper
    • Email Helper
    • File Helper
    • Form Helper
    • HTML Helper
    • Inflector Helper
    • Language Helper
    • Number Helper
    • Path Helper
    • Security Helper
    • Smiley Helper
    • String Helper
    • Text Helper
    • Typography Helper
    • URL Helper
    • XML Helper
Toggle Table of Contents
CodeIgniter
  • Selamat datang di CodeIgniter
  • Panduan Instalasi
    • Downloading CodeIgniter
    • Panduan Instalasi
    • Upgrade Dari Versi Sebelumnya
    • Penyelesaian Masalah
  • Ikhtisar CodeIgniter
    • Memulai dengan CodeIgniter
    • Sekilas Tentang CodeIgniter
    • Fitur yang Didukung
    • Alur Aplikasi
    • Model-View-Controller
    • Desain and Sasaran Arsitektur
  • Tutorial
    • Halaman Statis
    • Bagian Berita
    • Membuat Item Berita
    • Kesimpulan
  • Berkontribusi ke CodeIgniter
    • Menulis Dokumentasi CodeIgniter
    • Developer’s Certificate of Origin 1.1
  • Pembahasan Umum
    • CodeIgniter URLs
    • Controllers
    • Reserved Names
    • Views
    • Model
    • Helpers
    • Menggunakan Library CodeIgniter
    • Membuat Library
    • Using CodeIgniter Drivers
    • Membuat Driver
    • Membuat Class Inti Sistem
    • Membuat Class Tambahan
    • Hooks - Mengembangkan Inti Framework
    • Auto-loading Resources
    • Fungsi-fungsi Umum
    • Fungsi-fungsi Kompatibilitas
    • URI Routing
    • Penanganan Error
    • Caching
    • Profiling Aplikasi Anda
    • Menjalankan dengan CLI
    • Mengelola Aplikasi Anda
    • Handling Multiple Environments
    • Alternatif Syntax PHP untuk File View
    • Keamanan
    • PHP Style Guide
  • Referensi Library
    • Benchmarking Class
    • Caching Driver
    • Calendaring Class
    • Shopping Cart Class
    • Config Class
    • Email Class
    • Encrypt Class
    • Encryption Library
    • File Uploading Class
    • Form Validation
    • FTP Class
    • Image Manipulation Class
    • Input Class
    • Javascript Class
    • Language Class
    • Loader Class
    • Migrations Class
    • Output Class
    • Pagination Class
    • Template Parser Class
    • Security Class
    • Session Library
    • HTML Table Class
    • Trackback Class
    • Typography Class
    • Unit Testing Class
    • URI Class
    • User Agent Class
    • XML-RPC and XML-RPC Server Classes
    • Zip Encoding Class
  • Referensi Database
    • Quick Start: Contoh Penggunaan
    • Konfigurasi Database
    • Menghubungkan ke Database
    • Menjalankan Queries
    • Menampilkan Hasil Query
    • Fungsi-fungsi Query Helper
    • Query Builder Class
    • Transactions
    • Mendapatkan MetaData
    • Memanggil Custom Functions
    • Query Caching
    • Manipulasi Database dengan Database Forge
    • Database Utilities Class
    • Referensi Database Driver
  • Referensi Helper
    • Array Helper
    • CAPTCHA Helper
    • Cookie Helper
    • Date Helper
    • Directory Helper
    • Download Helper
    • Email Helper
    • File Helper
    • Form Helper
    • HTML Helper
    • Inflector Helper
    • Language Helper
    • Number Helper
    • Path Helper
    • Security Helper
    • Smiley Helper
    • String Helper
    • Text Helper
    • Typography Helper
    • URL Helper
    • XML Helper
 
CodeIgniter
  • Docs »
  • Berkontribusi ke CodeIgniter »
  • Menulis Dokumentasi CodeIgniter
  • classic layout

Menulis Dokumentasi CodeIgniter¶

CodeIgniter uses Sphinx to generate its documentation in a variety of formats, using reStructuredText to handle the formatting. If you are familiar with Markdown or Textile, you will quickly grasp reStructuredText. The focus is on readability and user friendliness. While they can be quite technical, we always write for humans!

A local table of contents should always be included, like the one below. It is created automatically by inserting the following:

.. contents::
        :local:

.. raw:: html

<div class="custom-index container"></div>
  • Tools Required
  • Page and Section Headings and Subheadings
  • Method Documentation

The <div> that is inserted as raw HTML is a hook for the documentation’s JavaScript to dynamically add links to any function and method definitions contained in the current page.

Tools Required¶

To see the rendered HTML, ePub, PDF, etc., you will need to install Sphinx along with the PHP domain extension for Sphinx. The underlying requirement is to have Python installed. Lastly, you will install the CI Lexer for Pygments, so that code blocks can be properly highlighted.

easy_install "sphinx==1.2.3"
easy_install sphinxcontrib-phpdomain

Then follow the directions in the README file in the cilexer folder inside the documentation repository to install the CI Lexer.

Page and Section Headings and Subheadings¶

Headings not only provide order and sections within a page, but they also are used to automatically build both the page and document table of contents. Headings are formed by using certain characters as underlines for a bit of text. Major headings, like page titles and section headings also use overlines. Other headings just use underlines, with the following hierarchy:

# with overline for page titles
* with overline for major sections
= for subsections
- for subsubsections
^ for subsubsubsections
" for subsubsubsubsections (!)

The TextMate ELDocs Bundle can help you create these with the following tab triggers:

title->

        ##########
        Page Title
        ##########

sec->

        *************
        Major Section
        *************

sub->

        Subsection
        ==========

sss->

        SubSubSection
        -------------

ssss->

        SubSubSubSection
        ^^^^^^^^^^^^^^^^

sssss->

        SubSubSubSubSection (!)
        """""""""""""""""""""""

Method Documentation¶

When documenting class methods for third party developers, Sphinx provides directives to assist and keep things simple. For example, consider the following ReST:

.. php:class:: Some_class

        .. php:method:: some_method ( $foo [, $bar [, $bat]])

                This function will perform some action. The ``$bar`` array must contain
                a something and something else, and along with ``$bat`` is an optional
                parameter.

                :param int $foo: the foo id to do something in
                :param mixed $bar: A data array that must contain a something and something else
                :param bool $bat: whether or not to do something
                :returns: FALSE on failure, TRUE if successful
                :rtype: bool

                ::

                        $this->load->library('some_class');

                        $bar = array(
                                'something'             => 'Here is this parameter!',
                                'something_else'        => 42
                        );

                        $bat = $this->some_class->should_do_something();

                        if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
                        {
                                show_error('An Error Occurred Doing Some Method');
                        }

                .. note:: Here is something that you should be aware of when using some_method().
                                For real.

                See also :meth:`Some_class::should_do_something`


        .. php:method:: should_do_something()

                :returns: Whether or not something should be done
                :rtype: bool

It creates the following display:

class Some_class¶
some_method($foo[, $bar[, $bat]])¶

This function will perform some action. The $bar array must contain a something and something else, and along with $bat is an optional parameter.

Parameter:
  • $foo (int) – the foo id to do something in
  • $bar (mixed) – A data array that must contain a something and something else
  • $bat (bool) – whether or not to do something
Kembali:

FALSE on failure, TRUE if successful

Return type:

bool

$this->load->library('some_class');

$bar = array(
        'something'             => 'Here is this parameter!',
        'something_else'        => 42
);

$bat = $this->some_class->should_do_something();

if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
{
        show_error('An Error Occurred Doing Some Method');
}

Catatan

Here is something that you should be aware of when using some_method(). For real.

See also Some_class::should_do_something()

should_do_something()¶
Kembali:Whether or not something should be done
Return type:bool
Next Previous

© Copyright 2014 - 2015, British Columbia Institute of Technology. Terakhir diperbarui pada Mar 10, 2017.

Built with Sphinx using a theme provided by Read the Docs.