Пример #1
0
heading("Home page");
#echo out the links
echo genLinks($links);
echo "<div id='main'>\n";
$db = new db("site", "localhost", "mike", "default");
#get the 4 most recient posts
$db->query("SELECT title, description, image, created  FROM post ORDER BY created LIMIT 4");
while ($line = $db->fetchNextObject()) {
    # we now have the results in the form $line->field
    $img = $line->image;
    $title = $line->title;
    $desc = $line->description;
    $time = $line->created;
    # echo time
    echo <<<SINGLEPOST

<div class='post'>
  <img src='{$img}' />
  <h3>{$title}</h3>
  <p>{$desc}</p>
  <p>{$time}</p>
</div>

SINGLEPOST;
}
echo "</div>";
echo htmlEnd();
function __autoload($class)
{
    require_once "../classes/{$class}.class.php";
}
</style>
</head>


<?php 
htmlBodyStart();
formStart();
getTextField();
echo getTextFieldV1('First Name', 'fname');
echo getTextFieldV1('Last Name', 'lname');
echo getTextFieldV2('Phone 1', 'phone1', 'cssClassA');
echo getTextFieldV3('Phone 2', 'phone2');
echo getTextFieldV3('City', 'city', 'cssClassA');
formEnd();
htmlBodyEnd();
htmlEnd();
function htmlStart()
{
    echo "<html>";
}
function htmlEnd()
{
    echo "</html>";
}
function htmlBodyStart()
{
    echo "<body>";
}
function htmlBodyEnd()
{
    echo "</body>";