Tworzenie stron WWW to podstawa pracy webmastera. Dlatego każdy webmaster ma swój Poradnik Webmastera, z którego korzysta gdy potrzebuje wiedzy o języku HTML, CSS albo szuka czegoś w kursie JavaScript. Dzięki tak potężniej dawce wiedzy może on tworzyć profesjonalnie wyglądające strony WWW.

pozycjonowanie stron poznań - Smutne Opisy - artykuly - Gry Online - ksiegarnia - Odzież i obuwie - Uroda - gify - mazury imprezy integracyjne - finanse i ubezpieczenia pkd - generatory - Golf 3 Klub Polska - odżywki olimp - hotel konferencje - hydraulik
Podręcznik PEAR
PoprzedniNastępny

Rozdział 4. Coding Standards

Spis treści
Indenting and Line Length
Control Structures
Function Calls
Class Definitions
Function Definitions
Comments
Including Code
PHP Code Tags
Header Comment Blocks
Using CVS
Example URLs
Naming Conventions
File Formats
E_STRICT-compatible code
Error Handling Guidelines
Best practices
Sample File (including Docblock Comment standards)

Notatka: The PEAR Coding Standards apply to code that is part of the official PEAR distribution. Coding standards often abbreviated as CS among developers and they aim to keep code consistent to be easily readable and maintainable by most of PEAR folks.

Indenting and Line Length

Use an indent of 4 spaces, with no tabs. This helps to avoid problems with diffs, patches, CVS history and annotations.

For Emacs you should set indent-tabs-mode to nil. Here is an example mode hook that will set up Emacs (ensure that it is called when you are editing PHP files):

(defun php-mode-hook ()
  (setq tab-width 4
        c-basic-offset 4
        c-hanging-comment-ender-p nil
        indent-tabs-mode
  (not
    (and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name))
      (string-match "\.php$" (buffer-file-name))))))

Here are Vim rules for the same thing:

set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4

It is recommended to keep lines at approximately 75-85 characters long for better code readability.


PoprzedniSpis treściNastępny
#PEAR on IRCPoczątek rozdziałuControl Structures

Copyright © 2007 Office. Designed by Free CSS Templates.