Tuesday, April 29, 2014

Creating OOP open source PHP mySQL Projects using eclips

Creating PHP Projects


PHP projects are the containers within which all PHP and other application files should be created.



Instructions on how to complete a procedure
To create a new PHP project:
  1. From the menu bar, go to File | New | PHP Project
    -Or- In PHP Explorer view, right-click and select New | PHP Project.
    The New PHP Project wizard is displayed.
new_php_project_wizard.png
  1. Enter the following information:
  • Project name - The required project name
  • Contents - Select whether to:
  • Create a new project in the workspace - Creates a new PHP project in the workspace directory.
  • Create a project from existing source - Creates a PHP project pointing to files situated outside of the workspace.
    Click Browse to select the required source content.
  • PHP Version - Select whether to:
  • Use default PHP settings - Uses the default PHP Interpreter settings.
  • Use project specific settings - Select the PHP version to be used for the project and whether ASP tags are used as PHP tags.
    See PHP Version Support for more information
  • Project Layout - Select whether to:
  • Use project as source folder - All resources within the project will be added to the Build Path by default.
  • Create separate folders for source files and public resources - Separate folders will be created in which you can place resources which should be included or excluded from the Build Path.
    See Configuring a Project's PHP Build Path for more information.
    The default setting for this option can be configured from the New Project Layout Preferences page.
  • JavaScript Support - Mark the 'Enable JavaScript support for this project' checkbox for JavaScript functionality (e.g. JavaScript Content Assist options) to be available to the project.
    See Enabling JavaScript Support in PHP Projects for more information.
  1. Click Next to configure the project's Include Path (this can also be done following the project creation).
  1. Click Next to configure the project's PHP Build Path (this can also be done following project creation).
  2. Click Finish.
The new PHP project will be created in your workspace and displayed in PHP Explorer View.
You can now start to develop your application by creating PHP Files or adding other resources to your project.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Configuring a Project's PHP Build Path


By configuring your project's PHP Build Path, you can select resources which will be included or excluded from the Build process.

Note:

If during project creation you selected the 'use project as source folder' under the Project Layout category, all resources within the folder will be added to the Build Path by default.
If you selected to 'create separate folders for source files and public resources' during the project's creation, resources in the 'public' folder will be excluded from the Build Path by default.

The project's PHP Build Path can be configured through the project's Build Path properties page, accessed by right-clicking the required project and selecting Build Path | Configure Build Path.

build_path_properties.png

This page allows you to add folders and resources to your Build Path and configure rules for including / excluding certain resources in the project.

You can configure your Build Path according to the options listed below.

Once you have made changes, click OK to save.

Note:

By default, all folders which are on your Build Path will be included in your Include Path.

Configuring Inclusion/Exclusion Patterns for the Project


By configuring inclusion/exclusion patterns for the Build Path, you can select to include or exclude all resources in your project which match a defined pattern.

Instructions on how to complete a procedure
To include/exclude resources from the Build Path:
  1. In the Build Path Properties page, expand the node next to the folder whose Inclusion/Exclusion pattern you want to configure and click Edit.
    -Or- In PHP Explorer view, right-click the folder whose Inclusion/Exclusion pattern you want to configure and select Build Path | Configure Inclusion / Exclusion Filters.
    The Inclusion and Exclusion patterns dialog is displayed.
  1. Click Add next to the Inclusion or Exclusion patterns panes.
    The Add Inclusion/Exclusion Pattern dialog is displayed.
  2. Enter or select the required resource(s) or pattern to include / exclude and click OK.
  3. Click Finish.
All resources in the project which match an inclusion pattern but do not match an exclusion pattern will be added to the Build Path.

Configuring Different Inclusion/Exclusion Patterns for Folders Within your Project


You can configure different inclusion/exclusion rules for child folders within a selected directory. However, you will need to exclude the selected child folder from the parent directory's Build Path and add it as a separate Build Path source folder. This is done to resolve any conflicts which may arise from configuring one pattern for the parent folder and another for the child.

Source folders can be created and/or added from the PHP Build Path properties page or from PHP Explorer view.

Instructions on how to complete a procedure
To add a directory as a separate source folder:
From the PHP Build Path Properties page:
  1. Click Add Folder...
    The Source Folder Selection dialog will display.
  2. If necessary, click Create New Folder to create a new folder.
  3. Select the required folder and click OK.
  4. The folder will be added as a separate source folder in the Build Path list.
Note:
In order to overcome the nesting conflict, you should exclude the folder you have just added from the parent folder's Build Path. See 'Configuring Inclusion/Exclusion Patterns', above, for information on how to exclude the folder and all resources contained within it.
build_path_add_source_folder.png
From PHP Explorer view:
  1. Right-click the project and select Build Path | New Source Folder.
    The New Source Folder dialog will be displayed.
build_path_new_source_folder.png
  1. Enter the name for the new folder in the Folder name field.
  2. Adding a folder to a project's Build Path could cause a conflict between the inclusion/exclusion patterns configured for the project root and those configured for the selected folder.
    In order to avoid these nesting conflicts, select one of the following options:
  • Replace existing project source folder entry to solve nesting - This will remove your parent directory as a source folder from the Build Path configuration and replace it with the currently selected folder.
  • Update exclusion filters in other source folders to solve nesting - This will exclude the currently selected folder from the parent directory's Build Path but will add it as a separate entity so that different inclusion/exclusion patters can be configured for it.
  1. Click Finish.
You can now configure a pattern for including/excluding resources for the source folder by following the instructions under 'Configuring Inclusion/Exclusion Patterns', above.

Adding External Source Folders to the Build Path


You can add an external source folder as a link to your project which will be scanned during the Build process.

Instructions on how to complete a procedure
To add an external source folder to the project's Build Path:
  1. In the Build Path Properties page, click the 'Link Source...' button.
    -Or- In PHP Explorer view, right-click the project and select Build Path | Link Source.
    The Link Source dialog is displayed.
build_path_link_source.png
  1. Click the 'Browse..' button and browse to the location of the folder you want to add to the Build Path.
    Alternately, click Variables and select the variable which points to the required resource.
  2. The Folder name field will have been automatically populated with the name of the original folder.
    Edit this entry if required.
  3. Adding a folder to a project's Build Path could cause a conflict between the inclusion/exclusion patterns configured for the project root and those configured for the selected folder.
    In order to avoid these nesting conflicts, select one of the following options:
  • Replace existing project source folder entry to solve nesting - This will remove your parent directory as a source folder from the Build Path configuration and replace it with the currently selected folder.
  • Update exclusion filters in other source folders to solve nesting - This will exclude the currently selected folder from the parent directory's Build Path but will add it as a separate entity so that different inclusion/exclusion patters can be configured for it.
  • Ignore nesting conflicts - The selected folder will be added as a separate entity to the Build Path list but will need to be manually excluded from the project root's Build Path to avoid nesting conflicts.
  1. Click Finish.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

New Project Layout Preferences


The New Project Layout Preferences page allows you to configure the default layout for new PHP projects. The default layout will configure whether all folders under the project root will be considered as 'source' folders for the Build process, or whether separate folders will be created for resources which are included or excluded from the Build process.



The preferences configured in the New Project Layout Preferences page will affect the default option selected in the Project Layout category of the New PHP Project wizard. This setting can be modified per project during creation.

new_project_project_layout.png

The New Project Layout Preferences page is accessed from Window | Preferences | PHP | New Project Layout Preferences .

new_project_layout_preferences.png

Instructions on how to complete a procedure
To configure the default New PHP Project Layout:
Select the required option:
  • Use project as source folder - By default, all folders created under the project root will be considered 'source folders' and will be scanned during the Build process.
    See Configuring a Project's PHP Build Path to configure the project's PHP Build Path.
  • Create separate folders for source files and public resources - Two folders will be created under your project root - one 'source' folder for resources which will be scanned during the Build process and one 'public' folder which will be skipped during the Build process.
    You can change the default names for these folders by entering the required name in the 'Default source/public folder name' fields.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Enabling JavaScript Support in PHP Projects


Enabling JavaScript support in PHP projects allows JavaScript libraries and external files to be referenced by the project .

Note:

Once JavaScript support has been enabled for a project, you should set the project's JavaScript Build Path in order for the required resources to be made available to the project.

These procedures describe how to enable JavaScript support for new PHP projects, add support to existing projects, or disable JavaScript support.

Enabling JavaScript Support for New PHP Projects


Instructions on how to complete a procedure
To enable JavaScript support in new PHP Projects:
  1. Go to File Menu and select New | PHP Project.
    -Or- In PHP Explorer view, right-click and select New | PHP Project.
    The new PHP Project wizard will launch.
  2. Enter the required information in the various fields.
  3. To enable JavaScript support, mark the 'Enable JavaScript support for this project' checkbox.
  1. Click Finish.
A new PHP Project will be created with full JavaScript support.



Enabling JavaScript Support for Existing PHP Projects


JavaScript libraries and features can be added to existing PHP projects in your workspace.

Instructions on how to complete a procedure
To enable JavaScript Support for existing PHP Projects:
In PHP Explorer view, right-click the project for which you want to enable JavaScript support and select Configure | Add Java Script Support.
JavaScript support will be enabled for the project.

Removing JavaScript Support


If you are not using JavaScript libraries or files in your project, you can remove JavaScript support for that project.

Instructions on how to complete a procedure
To remove JavaScript Support for existing PHP Projects:
In PHP Explorer view, right-click the project for which you want to enable JavaScript support and select Configure | Remove JavaScript Support.
JavaScript support will be removed from the project and no JavaScript libraries or external files will be available to the project.


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Configuring a Project's PHP Include Path


Adding external resources to a project's include path makes resources outside the project available for operations such as debugging and content assist. See PHP Include Paths for more information.

This procedure describes how to configure your project's Include Path.

Instructions on how to complete a procedure
To configure your project's Include Path:
  1. In PHP Explorer view, right-click the required project and select Include Path | Configure Include Path...
    -Or- right-click the project and select Properties | Include Path.
    The project's PHP Include Path properties page will appear.
Include Path Properties
From this page you can configure the following:
To configure source folders on your Include Path:
  1. Select the Source tab.
    By default, all folders which are on your Include Path will be added to your Build Path.
Note:
If your project root is on your Include Path, all folders and resources contained within your project will also be on the Include Path. To add only certain folders, remove the project root from the Include Path and add only the required folders.
  1. To remove a folder, select it and click Remove.
  1. To add a folder from your project, click the Add Folder button and select the required folder.
    A prompt will display, asking whether you would also like to add the selected folder(s) to your Build Path.
    It is recommended that the resources on your Build Path match the resources on your Include Path.
    Click Yes to add the folder(s) to your Build Path or No for your Build Path to not be affected.
To add another project from your workspace to your Include Path:
  1. Select the "Projects tab".
  2. Click Add.
    The Required Project Selection dialog appears.
  3. Select the projects you would like to add and click OK.
    The selected project(s) will be added to your project's Include Path.
    To add a library to your Include Path:
    1. Select the "Libraries tab".
    2. Click Add Library.
      The Add Library dialog appears.
    3. Select the required Library (if available) and click OK.
    To add external folders to your Include Path:
    1. Select the "Libraries tab".
    2. Click Add External Folder.
      The Add Include Path dialog appears.
    3. Browse to and select the required folder.
    4. Click OK.
      The folder will be added to your project's Include Path.
    Note:
    The library is a read-only file and will not be available for editing.
    To configure the order of elements on your Include Path:
    1. Select the "Order tab". This determines the order in which resources will be searched for in require/include calls.
      See Include Paths for more information on the order for which files are searched for.
      If applicable, it is recommended that elements appear in the same order as they do in your php.ini.
    2. If necessary, rearrange the order of the entries. To do so, select an element and click Up or Down to move it in the list.
    1. Once all the elements are added and are in the right order, click OK.
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Configuring a Project's PHP Build Path

    By configuring your project's PHP Build Path, you can select resources which will be included or excluded from the Build process.
    Note:
    If during project creation you selected the 'use project as source folder' under the Project Layout category, all resources within the folder will be added to the Build Path by default.
    If you selected to 'create separate folders for source files and public resources' during the project's creation, resources in the 'public' folder will be excluded from the Build Path by default.
    The project's PHP Build Path can be configured through the project's Build Path properties page, accessed by right-clicking the required project and selecting Build Path | Configure Build Path.
    build_path_properties.png
    This page allows you to add folders and resources to your Build Path and configure rules for including / excluding certain resources in the project.
    You can configure your Build Path according to the options listed below.
    Once you have made changes, click OK to save.
    Note:
    By default, all folders which are on your Build Path will be included in your Include Path.

    Configuring Inclusion/Exclusion Patterns for the Project

    By configuring inclusion/exclusion patterns for the Build Path, you can select to include or exclude all resources in your project which match a defined pattern.
    Instructions on how to complete a procedure
    To include/exclude resources from the Build Path:
    1. In the Build Path Properties page, expand the node next to the folder whose Inclusion/Exclusion pattern you want to configure and click Edit.
      -Or- In PHP Explorer view, right-click the folder whose Inclusion/Exclusion pattern you want to configure and select Build Path | Configure Inclusion / Exclusion Filters.
      The Inclusion and Exclusion patterns dialog is displayed.
    1. Click Add next to the Inclusion or Exclusion patterns panes.
      The Add Inclusion/Exclusion Pattern dialog is displayed.
    2. Enter or select the required resource(s) or pattern to include / exclude and click OK.
    3. Click Finish.
    All resources in the project which match an inclusion pattern but do not match an exclusion pattern will be added to the Build Path.

    Configuring Different Inclusion/Exclusion Patterns for Folders Within your Project

    You can configure different inclusion/exclusion rules for child folders within a selected directory. However, you will need to exclude the selected child folder from the parent directory's Build Path and add it as a separate Build Path source folder. This is done to resolve any conflicts which may arise from configuring one pattern for the parent folder and another for the child.
    Source folders can be created and/or added from the PHP Build Path properties page or from PHP Explorer view.
    Instructions on how to complete a procedure
    To add a directory as a separate source folder:
    From the PHP Build Path Properties page:
    1. Click Add Folder...
      The Source Folder Selection dialog will display.
    2. If necessary, click Create New Folder to create a new folder.
    3. Select the required folder and click OK.
    4. The folder will be added as a separate source folder in the Build Path list.
    Note:
    In order to overcome the nesting conflict, you should exclude the folder you have just added from the parent folder's Build Path. See 'Configuring Inclusion/Exclusion Patterns', above, for information on how to exclude the folder and all resources contained within it.
    build_path_add_source_folder.png
    From PHP Explorer view:
    1. Right-click the project and select Build Path | New Source Folder.
      The New Source Folder dialog will be displayed.
    build_path_new_source_folder.png
    1. Enter the name for the new folder in the Folder name field.
    2. Adding a folder to a project's Build Path could cause a conflict between the inclusion/exclusion patterns configured for the project root and those configured for the selected folder.
      In order to avoid these nesting conflicts, select one of the following options:
    • Replace existing project source folder entry to solve nesting - This will remove your parent directory as a source folder from the Build Path configuration and replace it with the currently selected folder.
    • Update exclusion filters in other source folders to solve nesting - This will exclude the currently selected folder from the parent directory's Build Path but will add it as a separate entity so that different inclusion/exclusion patters can be configured for it.
    1. Click Finish.
    You can now configure a pattern for including/excluding resources for the source folder by following the instructions under 'Configuring Inclusion/Exclusion Patterns', above.

    Adding External Source Folders to the Build Path

    You can add an external source folder as a link to your project which will be scanned during the Build process.
    Instructions on how to complete a procedure
    To add an external source folder to the project's Build Path:
    1. In the Build Path Properties page, click the 'Link Source...' button.
      -Or- In PHP Explorer view, right-click the project and select Build Path | Link Source.
      The Link Source dialog is displayed.
    build_path_link_source.png
    1. Click the 'Browse..' button and browse to the location of the folder you want to add to the Build Path.
      Alternately, click Variables and select the variable which points to the required resource.
    2. The Folder name field will have been automatically populated with the name of the original folder.
      Edit this entry if required.
    3. Adding a folder to a project's Build Path could cause a conflict between the inclusion/exclusion patterns configured for the project root and those configured for the selected folder.
      In order to avoid these nesting conflicts, select one of the following options:
    • Replace existing project source folder entry to solve nesting - This will remove your parent directory as a source folder from the Build Path configuration and replace it with the currently selected folder.
    • Update exclusion filters in other source folders to solve nesting - This will exclude the currently selected folder from the parent directory's Build Path but will add it as a separate entity so that different inclusion/exclusion patters can be configured for it.
    • Ignore nesting conflicts - The selected folder will be added as a separate entity to the Build Path list but will need to be manually excluded from the project root's Build Path to avoid nesting conflicts.
    1. Click Finish.

    Why you Should be using PHP's PDO for Database Access ??


    PDO Introduction

    "PDO - PHP Data Objects - is a database access layer providing a uniform method of access to multiple databases."
    It doesn't account for database-specific syntax, but can allow for the process of switching databases and platforms to be fairly painless, simply by switching the connection string in many instances.
    PDO - db abstraction layer
    This tutorial isn't meant to be a complete how-to on SQL. It's written primarily for people currently using the mysql or mysqli extension to help them make the jump to the more portable and powerful PDO.
    Read More On http://code.tutsplus.com/tutorials/why-you-should-be-using-phps-pdo-for-database-access--net-12059

    For PHP/mySQL Classes Projects Assignments
    CALL +94 777 33 7279