I am trying to create a page template for a site.
I have two files set up. One is the test page named test.php5
The second is the html_template_fns.php5 where I will do the layout pieces.
So I coded test as follows:
<?php
require_once('includes/html_template_fns.php5');
//set the page header area
do_html_header("OMGMA Test Page","../main.css");
?>
</head>
<body>
<div id="wrapper">
<div id="topmast">
<h1><img src="../assets/images/page_images/TopLogo.gif" alt="Oregon MGMA, State Affiliate" width="300" height="100"></h1>
</div>
<!-- Closes topmast -->
<!-- left Side Menus -->
<div id="sidebar">
<h2>OMGMA</h2>
<ul>
<li id="home"><a href="../index.htm">Home</a></li>
<li id="exec"><a href="../executive.htm">Executive Committee</a></li>
</ul>
</div> <!-- This closes sidebar div -->
<!-- This is where the middle page main column begins. -->
<div id="maincontent">
<h2>Main Content Here </h2>
<p>through a top-down, proactive approach we can remain customer
and goal-directed, innovate and be an inside-out organization f</p>
</div>
</div>
<!-- This closes the "wrapper" div -->
<!-- The Footer begins here - this div is outside of the wrapper -->
<div id="footer">
<p> © Copyright 2005 - 2006 Oregon Medical Group Management Association</p>
</div>
<!-- This closes the "footer" div -->
</body>
</html>
My include file is as follows:
<?php
function do_html_header($title, $style)
{
// print an HTML header
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"';
echo '"http://www.w3.org/TR/html4/loose.dtd">';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
echo "<title> $title </title>";
echo "<link rel='stylesheet' type='text/css' href=' ".$style ."'>";
}
?>
My questions:
#1 - When I view my generated source code all of the echos run together as one line, how do I get line breaks in there?
#2 - Is echo the best way to code this part?
Which leads me to my final question. Originally I had some code that didn't use echos and I couldn't get them working in here. Originally this would have been written like this:
<?
function do_html_header($title, $style)
{
// print an HTML header
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title><?=$title?></title>
<link rel="stylesheet" type="text/css" href="<?=$style?>">
<?
}
?>
When I name that xyz.php5 and then include it instead of the other one it doesn't load the title and style sheet I specified. Is that because of changes in PHP5 on passing variables or what? Register Globals is turned off.
Thanks!