<com:TForm>, <com:TTextBox> and <com:TButton>. It uses an index.php file, a home.page file written in the PRADO template format, and a Home.php script that contains the Home class and prints the values from the form.Index.php
<?php
$basePath=dirname(__FILE__);
$frameworkPath=$basePath.'/../../framework/prado.php';
$assetsPath=$basePath.'/assets';
$runtimePath=$basePath.'/protected/runtime';
require_once($frameworkPath);
$application=new TApplication;
$application->run();
?>
Home.page
<com:TForm>
<fieldset><legend>Login</legend>
<label>Username: </label>
<com:TTextBox ID="username"/>
<br />
<label>Password: </label>
<com:TTextBox ID="password" TextMode="Password" />
<br />
<com:TButton Text="Login" OnClick="buttonClicked" />
</com:TForm>
Home.php
<?php
class Home extends TPage
{
public function buttonClicked($sender,$param)
{
$username = $this->username->Text;
echo "Username: ".$username."<br />";
$password = $this->password->Text;
echo "Password: ".$password."<br />";
}
}
?>
Click here for larger image
Figure 1. The Basic Login Form Created Using PRADO Template Format Before and After Inserted Values
Home.php listing.
Figure 2. The Output of the Home.php Listing
TTable, TTableRow and TTableCell PRADO components into your application and how to make use of the most commonly used methods for styling a table.Home.page
<com:TForm>
<com:TTable ID="table">
<com:TTableRow ID="row1">
<com:TTableCell Text="Name" />
<com:TTableCell Text="Surname" />
</com:TTableRow>
<com:TTableRow ID="row2">
<com:TTableCell Text="Telephone" />
<com:TTableCell Text="Adress" />
</com:TTableRow>
<com:TTableRow ID="row3">
<com:TTableCell Text="E-mail"/>
<com:TTableCell Text="Age" />
</com:TTableRow>
</com:TTable>
<com:TButton Text="View Table" OnClick="buttonClicked" />
</com:TForm>
TTable PRADO components.
Figure 3. The Initial Table Created Using the TTable PRADO Components
Home.php
<?php
class Home extends TPage
{
public function buttonClicked($sender,$param)
{
//setting the background color and the border width for a table
$table_color = $this->table->setBackColor('#FF3399');
echo $table_color;
$this->table->setBorderWidth('4');
$table_border_color = $this->table->setBorderColor('#CC0066');
echo $table_border_color;
//setting the horizontal grid lines
$table_grids = $this->table->setGridLines('Horizontal');
echo $table_grids;
//setting the cell padding
$table_cellpadding = $this->table->setCellPadding ('20');
echo $table_cellpadding;
//setting a background image for the table
$table_image = $this->table->setBackImageUrl('1.jpg');
echo $table_image;
}
}
?>
Click here for larger image
Figure 4. Styling a Table Step by Step