PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   ArGender   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArGender
Guess the gender of Arabic names
Author: By
Last change: Define character set explicitly when get a class instance
Date: 18 years ago
Size: 2,350 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=windows-1256" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Arabic Gender Guesser</title>
</head>

<body>

<center>
<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="example.php">Example</a>
</div>

<div class="Paragraph">

<h2>Arabic Gender Guesser</h2><br />

<div class="img-shadow">
<img src="images/thumb.jpg" alt="Khaled Al-Sham'aa" border="0" width="150" height="113" />
</div>

      <span class="FirstChar">A</span>rabic nouns are either masculine or feminine. Usually when referring
      to a male, a masculine noun is usually used and when referring to a female, a feminine noun is used.
      In most cases the feminine noun is formed by adding a special characters to the
      end of the masculine noun.
      Its not just nouns referring to people that have gender. Inanimate objects (doors, houses, cars, etc.)
      is either masculine or feminine. Whether an inanimate noun is masculine or feminine is mostly arbitrary.

<?php
$names
= file('list.txt');
$charset = 'windows-1256';

include(
'ArGender.class.php');
$check = new ArGender($charset);
?>

<p>
<table border="0" cellspacing="2" cellpadding="5" width="60%">
  <tr><td colspan="2"><b>Al Jazeera Reporters:</b></td></tr>
  <tr>
    <td bgcolor="#27509D" align="center" width="50%">
      <b><font color="#ffffff">Name (sample input)</font></b>
    </td>
    <td bgcolor="#27509D" align="center" width="50%">
      <b><font color="#ffffff">Gender (auto generated)</font></b>
    </td>
  </tr>

<?php
foreach($names as $name){
    if(
$check->isFemale($name) == true){
      
$gender = 'Female';
      
$bgcolor = '#FFF0FF';
    }else{
      
$gender = 'Male';
      
$bgcolor = '#E0F0FF';
    }
    echo
'<tr><td bgcolor="'.$bgcolor.'" align="center"><font face="Tahoma">'.$name.'</font></td>';
    echo
'<td bgcolor="'.$bgcolor.'" align="center">'.$gender.'</td></tr>';
}
?>

</table>
</p>

</div>
<br />
</div>
</center>
</body>
</html>