Jump to content


Best way to add pages to a website?


1 reply to this topic

#1 Empresive

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 24 January 2009 - 11:10 PM

Hi,

Does any one know of the best way to add pages to a website?

What i'm trying to do is when a link is click on my site navigation i would like for the page to load with in my web template without braking it all up like i would have to do when using php to have index.php?=page1 and using mod_rewrite to make it mysite.com/page but viewing the code of my site it will show every head tag of each page being called.

For Example

Quote

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
header code blah blah blah...</body>
</html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
site content code and stuff
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
footer code here blah blah blah
</body>
</html>

Is there a better way to link my pages were editing them is easy and doesnt require to have everything called from diffrent pages like header.php, footer.php, content.php and so on.

Edited by Empresive, 24 January 2009 - 11:13 PM.


#2 023-jimmy

    Young Padawan

  • Members
  • Pip
  • 44 posts

Posted 25 January 2009 - 05:15 AM

I don't have time now to explain the navigation now. When I'm back from work and nobody else answered I'll help you with that.

I use this script for navigation:
<?php
	if (isset($_GET['p'])) {

			$val = $_GET['p'];
			$val .= ".php";

			$dirty = array("..");
			$clean = array("");
			$val = str_replace($dirty, $clean, $val);

				if (file_exists($val)) {
					include $val;
				} else {
					include "404.php";
				}
		} else {
			include "404.php";
		}
?>


You HTML code is not good. html, head and body tags only need to be there once(nested) and you need to put a doctype. So like this:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>

</body>
</html>

Edited by 023-jimmy, 25 January 2009 - 02:14 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users