Tuesday, August 29, 2006

PHP DataGrid v.1.x.x





--------------------------------------------------------------
To download version 1.1.1 click here.
This version changes:
 - fixed bugs in getHeaderName()
 - fixed bugs in noDataFound()
 - fixed bugs in setColumnsInViewMode()
 - fixed bugs in combine_url()
 - fixed bugs in setCssClass()

To download version 1.1.0 click here.



--------------------------------------------------------------
PHP DataGrid document for version 1.x.x
--------------------------------------------------------------

1. System Requirements
------------------------------
PHP DataGrid is operating system independent. You get it works on both Linux and
Windows. You need following components are installed:

- PHP 4.0 script engine or later
- Apache 1.3 or above
- mySQL 3.23 or above

2. Installation
------------------------------
<? include("$PHP_DATAGRID_FILE_PATH/datagrid.class") ?>
Where $PHP_DATAGRID_FILE_PATH - is a file path where PHPDataGrid stored on your server.

You may also use require() PHP function instead of include().

3. Features
------------------------------
- View mode
- Columns sorting
- Paging
  -- current/total pages selector
  -- pager
  -- page size drop-down box
- embedded css templates


To see an example of code click here.

To download version 1.1.1 click here.
--------------------------------------------------------------

Monday, August 28, 2006

Examples of code PHP DataGrid v.1.x.x

In datagrid.class file you can find commented lines of how to create, call and work with this class.

All you need is to copy all commented lines of the code into you page and uncomment some lines. That's all!

Now we'll check this example to get you understanding how it works.
For example, we have a database (mySQL) with 3 tables:

country
   CountryID
   RegionID
   Name
   Description
   Population
   PictureURL
   democraty
regions
   RegionID
   Name
democracy
   did
   description

// creating variables that we need for database connection
$DB_USER='root'; // often like this: prefix_name
$DB_PASS=''; // must be already enscrypted
$DB_HOST='localhost'; // often localhost
$DB_NAME='thebutto_test'; // often like this: prefix_name

ob_start();
// now we create connection with our database
$db_conn=mysql_connect($DB_HOST,$DB_USER,$DB_PASS); mysql_select_db($DB_NAME,$db_conn);

// create sql statment (any SELECT statment you want)
// it's recomended to put Primary Key at the first place (CountryID in this example)
$sql="SELECT ".
" countries.CountryID, ".
" countries.Name, ".
" regions.Name as Region, ".
" countries.Description, ".
" countries.Population, ".
" countries.PictureURL, ".
" democraty.description as isdemocraty ".
" FROM countries ".
" INNER JOIN regions ON countries.regionID=regions.regionID ".
" LEFT OUTER JOIN democraty ON countries.democraty=democraty.did ";

// creating a new instance of DataGrid class
$dgrid = new DataGrid();

// linking data source with DataGrid
$dgrid->dataSourse($db_conn, $sql);

// General Settings
// ---------
/*** here we give unique names for HTML elements */
$dgrid->setUniqueNames("_abc");
/*** wich layout we want: 0-tabular(default), 1-columnar */
$dgrid->setLayouts(array("view"=>0));
/*** set for all columns 'nowrap' parameter */
$dgrid->setColumnsNoWrap("nowrap");
/*** set css class, default: "default" */
$dgrid->setCssClass("default");

// Sorting & Paging Settings:
// ---------
/*** allow sorting on columns: true/false; default - true */
$dgrid->allowSorting(true);
/*** allow paging option: true/false; default - true */
$dgrid->allowPaging(true);
/*** set paging settings: on top & bottom
$dgrid->setPagingSettings(
array("results"=>true, "results_align"=>"left",
"pages"=>true, "pages_align"=>"center",
"page_size"=>true, "page_size_align"=>"right"),
array()
);


// View Mode Settings:
// ---------
/*** set view mode settings: */
$dgrid->setColumnsInViewMode(array(
"Name" =>array("header"=>"Country","type"=>"label"),
"Region" =>array("header"=>"Region","type"=>"label"),
"PictureURL" =>array("header"=>"Image","type"=>"link",
"href"=>"http://www.yahoo.com", "target"=>"_new"),
"isdemocraty" =>array("header"=>"Is Democraty","type"=>"label")
));

/*** set debug mode = true/false(default) $ messaging = true(default)/false */
$dgrid->bind(false, false);
ob_end_flush();

Now, let's see what we've got:




« Back to description

Sunday, August 27, 2006

PHP DataGrid Version Comparison

This is a general version comparison for PHP DataGrid class:

Ver. 1.x.x Ver. 2.x.x Ver. 3.x.x Ver. 4.x.x
CSS emb.templatesYesYesYesYes
Column sortingYesYesYesYes
FilteringNoYesYesYes
PaggingYesYesYesYes
ExportingNoNoNoYes
PrintingNoNoNoYes
Automatic validationNoNoYesYes
-- Client sideNoNoYesYes
-- Server sideNoNoNoNo
View modeYesYesYesYes
-- Tabular layoutYesYesYesYes
-- Columnar layoutYesYesYesYes
Details modeNoYesYesYes
-- Columnar layoutNoYesYesYes
Add new modeNoNoYesYes
-- Tabular layoutNoNoYesYes
-- Columnar layoutNoNoYesYes
Edit modeNoNoYesYes
-- Tabular layoutNoNoYesYes
-- Columnar layoutNoNoYesYes
Delete modeNoNoYesYes
Multi-Database supportNoNoNoYes
Multi-Language supportNoNoNoYes
Multi-Browser supportNoNoNoYes
W3C CSS validationNoNoNoYes
WYSIWYG editorNoNoNoYes

Saturday, August 26, 2006

FAQ


 1.  Who you are?
 2.  Why you do it?
 3.  Is all scripts on this blog are absolutely free?
 4.  What to do if I found bug/s?
 5.  What to do if I can't run a script?
 6.  How can I to subscribe for the blog news?
 7.  How can I help to the PHP Builder project?


Q1: Who you are?
A1:


Lifelike Electronic Unit Manufactured for Accurate Sabotage


^ top



Q2: Why you do it?
A2: I really do not know. :) May be because... I like PHP programming and I want people will like it too. Also I want to create something useful... very and very nice product, which will give to PHP programmers an advantage. Anyway, until I like it - this site will be live.
^ top


Q3: Is all scripts on this blog are absolutely free?
A3: Yes, you can use it for yourself, in your projects, but you could not sell these scripts. For more information, see a license for each script (included in downloading archive).
^ top


Q4: What to do if I found bug/s?
A4: Post you message on the forum of the blog (recommended) or send me e-mail.
^ top


Q5: What to do if I can not run a script?
A5: Post your message on blog's forum with example of your code or error description.
^ top


Q6: How can I to subscribe for the blog news?
A6: Just click here and follow instructions.
^ top


Q7: How can I help to the PHP Builder project?
A7: Read here about different ways to help the project.
^ top