Bu kod ile neyin yanlış olduğunu bilmiyorum, bu bir hata ya da ben bir yerde hata yaptım; hiçbir şey göstermiyor xdebug.
Class script
class theme {
function theme() {
//show header (meta, style, htmldoctype, script, and title)
$this->htmlheader();
//show main content
//show footer
}
function htmlheader() {
require "localsettings.php";
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
echo "<title>$site_name - $page_title</title>\n";
echo "</head>\n";
}
}
index.php
require "theme.class.php";
$html = new theme();
//display result
$html->theme();
Output (incorrectly repeated)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>site title - </title>
</head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>site title - </title>
</head>