[vox-tech] PHP Include File Problem

Alan H. Lake vox-tech@lists.lugod.org
09 Dec 2002 18:04:22 -0500


Your problem doesn't appear to me to be a PHP Include file problem as
much as an XML formatting problem.  I'm more familiar with PHP than I am
with XML.  The statement 
<?xml version="1.0"?>
seems to be your problem because the code that follows appears to be
HTML, not XML.  What happens if you take that line out?

-Alan

On Mon, 2002-12-09 at 17:46, Jim Angstadt wrote:
> Hi All,
> 
> I just started to learn PHP and need help with 
> an include file. Below are 3 test files.
> 
> The 4th line of html_header, ie. the xml declaration,
> creates a parse error:
> 
>    parse error in [snip]/html_header.php on line 4
>    
> When the line is removed, no parse error and the page 
> displays with all vars populated properly.
> 
> Somehow I need to escape those pesky characters or ???
> 
> RedHat 7.2, PHP 4.0.6, Mozilla 0.9
> 
> Thanks,
> Jim
> 
> 
> # ---------- include.php, called from browser
> <?php
> 
> $css_ref	= "../africa_loc.css";
> $h1		= "Sample H One Heading";
> $h2		= "An H Two Heading";
> $footer_subject	= "$h1, $h2";
> $home_page	= "http://jima9.tripod.com/fam/index.html";
> 
> include("html_header.php");
> html_header_10_strict( $css_ref, $h1, $h2 );
> 
> include("html_footer");
> ?>
> # ----------
> 
> 
> # ---------- html_header.php, called from include.php
> <?php
> function html_header_10_strict ( $css_ref, $h1, $h2 )
> {
> ?>
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> Strict//EN"
>   
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta name="robots" content = "noindex, nofollow" />
> <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1" />
> 
> <link rel="stylesheet" type="text/css" href="<?php
> echo "$css_ref"; ?>" />
> <meta name="keywords" content="one, " />
> <title><?php echo "$h1"; ?></title>
> </head>
> 
> <body lang="en">
> <div class="pane">
> <h1><?php echo "$h1"; ?></h1>
> <h2><?php echo "$h2"; ?></h2>
> <?php
> }
> ?>
> # ---------- 
> 
> 
> # ---------- html_footer, called from include.php
> </div>
> 
> <p class="footer">
> Please report errors, typos, or problems to <a href= 
> "mailto:jimajima9@yahoo.com?subject = <?php echo
> "$footer_subject"; ?>">
> jimajima9@yahoo.com</a><br />
> Visit the <a href="<?php echo "$home_page"; ?>">home
> page</a> of this site.
> </p>
> 
> </body></html>
> # ----------
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
-- 
Alan H. Lake <alan.lake@lakeinfoworks.com>
Lake Information Works