zaniac Posted June 13, 2007 Share Posted June 13, 2007 I read in a book that you can call files to help display your web page (e.g header or footer). Just wondered if such an idea is worth using for a website, as surely simple HTML/CSS can do this job outside of PHP scripts. Does anyone call files in PHP scripts for such display purposes? Also would calling a PHP script take longer to display than simple graphic files used through HTML/CSS?Thanks for any comments you guys can give Link to comment Share on other sites More sharing options...
zppblood Posted June 13, 2007 Share Posted June 13, 2007 Think of it like variables; set them to a value (file name), edit that file and all pages look the same at the top/bottom. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 13, 2007 Share Posted June 13, 2007 People use include files like that so that they can have 1 file that is used on every page, such as a menu. Then if they change the menu file, every page gets updated. You can't do that include with just HTML, it requires active content. So people use PHP for this, but there is not necessarily any PHP code in the included file. The included header might look like this: <html> <head> <title>Page Tile</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> Maybe that is all the file contains, just some HTML, no PHP. But the file that includes that would need a line of PHP to do that: <?phpinclude 'header.php';?><div>this is the body text</div><?phpinclude 'footer.php';?> Link to comment Share on other sites More sharing options...
zaniac Posted June 15, 2007 Author Share Posted June 15, 2007 People use include files like that so that they can have 1 file that is used on every page, such as a menu. Then if they change the menu file, every page gets updated. You can't do that include with just HTML, it requires active content. So people use PHP for this, but there is not necessarily any PHP code in the included file. The included header might look like this:<html> <head> <title>Page Tile</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> Maybe that is all the file contains, just some HTML, no PHP. But the file that includes that would need a line of PHP to do that: <?phpinclude 'header.php';?><div>this is the body text</div><?phpinclude 'footer.php';?> Hi guys, yes I see the sense in the idea now, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.