Friday, February 11, 2011

About Drupal


Installation Problem
While install drupal you if you have a problem in database steps, you can edit the settings.php (default.settings.php) file in sites/default folder.
Line number 92 : $db_url = 'pgsql://username:password@localhost/databasename' change to $db_url = 'mysql://root:@localhost/drupal_6_19';
Adminstrator Section
By default adminstrator page  is task based and divided into five administrative areas.
  • Content management - Manage your site's content. Most anything to do with content itself will be here.
  • Site building - Control how your site looks and feels. Here you make structure changes to your sites look and feel.
  • Site configuration - Adjust basic site configuration options. Adjust and configure site behavior, name, email settings, cache, date and time, etc.
  • User Management - Manage your site's users, groups and access to your site features. Here you can manage accounts, users, roles and default registration requirements.
  • Reports - View reports from system logs and other status information. Various logs and information on your site are located here.
Content Mangement
The following sections explain how to manage your site's content.
Books
Learn how to use books to create and manage structured, multi-page hypertexts such as site resource guides, manuals, and Frequently Asked Questions (FAQs).

Comments *
Manage the comments on your site. You can also approve pending comments and delete unwanted ones.

Content *
Manage your site's content.

Content types *
Manage the content-types available on your site, such as "Page", "Story", and "Blog". This section explains how to rename, configure, change and delete content types as your site needs dictate.

Feed aggregator
Manage your feed aggregator, a powerful on-site syndicator and news reader that gathers fresh content from RSS-, RDF- and Atom-based feeds made available across the web.

Forums
Manage your forum topics, sub-sections and comments from within this section.

Post settings *
Configure specific settings for content, such as maximum number of posts to display per page, or the maximum number of characters to display in a trimmed post.

Taxonomy *
Taxonomy allows you to create categories to sort and manage your content.

Books Expanation
The book module is suited for creating structured, multi-page hypertexts such as site resource guides, manuals, and Frequently Asked Questions (FAQs). It permits a document to have chapters, sections, subsections, etc. Authors with suitable permissions can add pages to a collaborative book, placing them into the existing document by adding them to a table of contents menu.
Users with the administer book outlines permission can add a post of any content type to a book, by selecting the appropriate book while editing the post or by using the interface available on the post's outline tab.
Administrators can view a list of all books on the book administration page. The Outline page for each book allows section titles to be edited or rearranged.
A book is a set of pages tied together in a hierarchical sequence, perhaps with chapters, sections, subsections, and so on. You can use books for manuals, site resource guides, Frequently Asked Questions (FAQs), or whatever you'd like.

Thursday, November 19, 2009

How to write own MVC PHP Framework


What is MVC?
From Wikipedia-
Model–View–Controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.
In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, check box items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.
In simpler words-
1. Model handles all our database logic. Using the model we connect to our database and provide an abstraction layer.
2. Controller represents all our business logic i.e. all our ifs and else.
3. View represents our presentation logic i.e our HTML/XML/JSON cod

MVC Structure Work Flow


























Existing PHP Framework

PHP Popular Frameworks

    1. Zend
    2. Symfony
    3. CodeIgniter
    4.  CakePH
    PHP Application Frameworks
          1. Joomla
          2. Durpal
          3. Wordpress
          4. OSCommerce
          5. Magento
    To write the own framework, first need to understand the structure of any one the above frameworks ( zend, symfony, codeigniter or cakePHP).


    Mission

    Our mission is to build a PHP framework with MVC that is
        1. Simple
        2. Reusable
        3. Fast
        4. Extensible in future
        5. light-weight

    Core Components


    For the MVC framework structure we need the following components

    1. Controller
    2. Model
    3. View & Layout
    4. Access Control


    Directory Structure



    The framework should follow the standard directory structure to organize or hold the files.

    • /Framework or root folder
      • /application
        • /controller
        • /model
        • /view
          • /layout
      • /lib
      • /config
      • /public_html
        • /css
        • /images
        • /scripts

    The purpose of the each directory

    application - application specific code
    config - database/server configuration
    lib – library of framework code
    public_html - application specific js/css/images/scripts





    Coding Conventions 
    1. mySQL tables will always be lowercase and plural e.g. items, cars
    2. Models will always be singular and first letter capital e.g. Item, Car
    3. Controllers will alway be singular and first letter capital e.g. Item, Car
    4. Views will have plural name followed by action name as the file. e.g. items/view.php, cars/buy.php