- glob: documentation ( source)
- explode: documentation ( source)
- file: documentation ( source)
<!DOCTYPE html>
<html lang=en>
<!-- Eitan Zinberg: This file contains text for review of TMNT. It is
linked to a css document that formats it. -->
<head>
<title>Rancid Tomatoes</title>
<meta charset="utf-8" />
<link href="movie.css" type="text/css" rel="stylesheet" />
<link href="http://ycfac197.mc.yu.edu/COM3780/12fa/homework/2/rotten.gif"
type="image/gif" rel="shortcut icon" />
</head>
<body>
<?php
$movie = $_GET ["film"];
$info = file($movie . "/info.txt");
$rating = get_rating($info[2]);
function get_rating($number){
if ($number >= 60){
return "Fresh";
}
else{
return "Rotten";
}
}
?>
<div id="banner">
<img src="http://ycfac197.mc.yu.edu/COM3780/12fa/homework/2/banner.png"
alt="Rancid Tomatoes" />
</div>
<h1><?= $info[0] ($info[1]) ?></h1>
<div id="content">
<div id="overview">
<div>
<img src="<?= $movie ?>/overview.png" alt="general overview" />
</div>
<dl>
<?php
$overview = file($movie . "/overview.txt");
foreach($overview as $line){
list($heading, $details) = explode(":", $line)
?>
<dt><?= $heading ?></dt>
<dd><?= $details ?> </dd>
<?php } ?>
</dl>
</div>
<div id="reviews">
<div id="rating">
<img src="http://ycfac197.mc.yu.edu/COM3780/12fa/homework/2/<?= $rating ?>big.png"
alt="<?= $rating ?>" />
<span><?= $info[2] ?>%</span>
</div>
<div class="column">
<?php
$count = 0;
$files = glob($movie . "/review*.txt");
$number = count($files);
foreach($files as $reviews){
list($review, $freshness, $name, $publication) = $reviews;
?>
<p>
<img src="http://ycfac197.mc.yu.edu/COM3780/12fa/homework/2/<?= $freshness ?>.gif"
alt="<?= $freshness ?>" />
<q><?= $review ?></q>
</p>
<p>
<img src="http://ycfac197.mc.yu.edu/COM3780/12fa/homework/2/critic.gif"
alt="Critic" />
$<?= $name ?><br />
<span class="publication"><?= $publication ?></span>
</p>
<?php
$count++;
if($count >= $number/2){
?>
</div>
<div class="column">
<?php
}
?>
<?php } ?>
</div>
<footer><span>(1- <?= $number ?> ) of <?= $number ?></span></footer>
</div>
<div id="validator">
<a href="http://validator.w3.org/check/referer"><img src="http://ycfac197.mc.yu.edu/COM3780/icons/w3c-html.png" alt="Valid HTML5"></a>
<br/>
<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3"><img src="http://ycfac197.mc.yu.edu/COM3780/icons/w3c-css.png" alt="Valid CSS"></a>
</div>
</body>
</html>