Lassie Posted January 27, 2009 Share Posted January 27, 2009 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 More sharing options...
dennismonsewicz Posted January 27, 2009 Share Posted January 27, 2009 make sure that your paths are correct. Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-747573 Share on other sites More sharing options...
Lassie Posted January 27, 2009 Author Share Posted January 27, 2009 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. Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-747658 Share on other sites More sharing options...
TheStalker Posted January 27, 2009 Share Posted January 27, 2009 what is the error your getting? i dont think you can have any white space before calling a header Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-747729 Share on other sites More sharing options...
haku Posted January 27, 2009 Share Posted January 27, 2009 Use this: <link href="/authorbank/includes/layout.css" media="screen" rel="stylesheet" type="text/css" /> Also, you have to remove those spaces before your doctype, or your doctype won't work. Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-747744 Share on other sites More sharing options...
Lassie Posted January 28, 2009 Author Share Posted January 28, 2009 Thanks. Spaces before doc type? Not clear what you mean here.Can you elaborate please? Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-748347 Share on other sites More sharing options...
haku Posted January 28, 2009 Share Posted January 28, 2009 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"> Link to comment https://forums.phpfreaks.com/topic/142619-function-fails-to-include-file/#findComment-748515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.