Jump to content

Calling PHP files for display purposes


zaniac

Recommended Posts

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

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

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

Archived

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

×
×
  • Create New...