Jump to content

function fails to include file


Lassie

Recommended Posts

I have a simple site to build and am trying to includer a header file.

My structure is to functions from an overall require file (ab_fns.php).

At present there is only a display_fns.php to include. which loads a header and a stylesheet.

This does not happen.

Can anyone help please.

link http://217.46.159.226/authorbank/index.php

display_fns.php

 

<?php

function do_html_header()
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Authorbank</title>

<link href="./includes/layout.css media="screen"
rel="stylesheet" type="text/style" />
<?php	
}
?>
ab_fns.php
[code]
<?php
include_once ('display_fns.php');

?>

[/code]

 

Link to comment
https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/
Share on other sites

I have checked the path and it seems in order.

For example,http://217.46.159.226/authorbank/includes/layout.css gives the css.

In my code the link is <link href="./includes/layout.css" media="screen"

rel="stylesheet" type="text/style" />

I cant see whats wrong. I have tried ../ and.../ which i wouldnt expect to work.

i have used the same set up before and it works.

Look at this code:

 

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

Actually, looking at your actual site, it wasn't spaces, it was a tab. The forum here just changed that tab to spaces. Either way, you need to get rid of the blank tab before the opening bracket (<). So it should look like this:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.