PHP

Screen Shot 2014-12-09 at 14.36.40

Index 

</pre>
<!doctype html>
<html>
<head>
<title>Format Code</title>
<link href="css/styles.css" rel="stylesheet" >
</head>

<body>
<div class="container">
<?php $food = array("Chips", "Chocolate", "Fish","Burger"); ?>
<?php $images = array("Cheap-as-Chips", "Yorkie-Bar", "Prod9","img-large-burger"); ?>
<?php $text = array("Chips yum", "Chocolate yum", "Fish mmmm","Burger yummy"); ?>

<?php $title = "Box"; ?>
<?php $numberOfBoxes = count($food) ; ?>

<?php include 'nav.php'; ?>

<div class="top-title">
<h1><?php echo "Home Page - PHP"; ?></h1>
</div>
<?php for($x = 0; $x <$numberOfBoxes; $x++) { ?>

<?php include 'box.php'; ?>

<?php } ?>
</div>
</body>
</html>

Box

</pre>
<div class="box">

<img src="images/<?php echo $images[$x]; ?>.jpg" />

<h2><?php echo $food[$x]; ?></h2>

<p><?php echo $text[$x]; ?></p>

</div>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s