a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
48
php-practice/web/html/wikipedia-tutorial/classes.php
Normal file
48
php-practice/web/html/wikipedia-tutorial/classes.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
require_once("_head.php");
|
||||
|
||||
mkheader("classes!", '#8bb');
|
||||
|
||||
|
||||
class html {
|
||||
private $contents = "";
|
||||
private $heading = "";
|
||||
|
||||
public function __construct($heading) {
|
||||
$this->heading = $heading;
|
||||
}
|
||||
|
||||
public function addparagraph($message) {
|
||||
$this->contents .= ("<p>" . $message . "</p>\n");
|
||||
}
|
||||
|
||||
public function show() {
|
||||
print "\n\n<h1>" . $this->heading . "</h1>\n";
|
||||
print $this->contents;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$elvis = new html("Elvis ist rad");
|
||||
$goth = new html("Goth Poetry ist rad");
|
||||
|
||||
$elvis->addparagraph("Welcome to my Elvis Fan Page! Uh-huh, uh-huh, uh-huh.");
|
||||
$elvis->addparagraph("Do you love Elvis? Yes! Yes you do!");
|
||||
|
||||
$goth->addparagraph("Enter thee into the Goth Poetry Labyrinth of Spooooky Dooooom...");
|
||||
$goth->addparagraph("Many terribly terrifying poems await thee.");
|
||||
|
||||
$elvis->show();
|
||||
|
||||
printf("\n<p style='border-bottom:3px solid #222;'></p>\n");
|
||||
|
||||
$goth->show();
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user