Jump to content

[SOLVED] Is this the right way ?


kOe

Recommended Posts

I`m new to php I started few days ago learning ...I come up with this code for a web page ...is this the right way to do it ? if not what I`m doing wrong ?

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>The World Of Lineage 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include ("header.html");
?> 
<?php
include ("menu.html");
?>
<?php 

	$link = $_GET['id'];
switch ($link) {
	case "1":
		include("info.html");
		break;
	case "2":
		include("fun.html");
		break;
	case "3":
		include("members.html");
		break;
	case "4":
		include("gallery.html");
		break;
	default:
		include("content.html");
}
?>
		<?php
		include ("right.html");
		?>
			<?php
			include ("status.html");
			?>
				<?php
				include ("footer.html");
				?>
</body>
</html>

 

menu.html

<div id="nav">
<ul>
	<li class="nlink"><a href="index.php?id=home">Home</a></li>
	<li class="nlink"><a href="index.php?id=1">Info</a></li>
	<li class="nlink"><a href="index.php?id=2">Fun Art</a></li>
	<li class="nlink"><a href="index.php?id=3">Members</a></li>
	<li class="nlink"><a href="index.php?id=4">Gallery</a></li>
	<li class="nlink"><a href="forum.html">Forum</a></li>
	<li class="nlink"><a href="credits.html">Credits</a></li>
	<li class="nlinkend"><a href="links.html">Links</a></li>
</ul>
</div>

 

the webpage works fine but I`m not sure if this is the way to do this ...

Thx in advace for any reaply ... just dont be to "hard" on me i`m noob ;D

Link to comment
https://forums.phpfreaks.com/topic/144934-solved-is-this-the-right-way/
Share on other sites

If it works for you, great.

 

One word of advice:

<?php
include ("header.html");
?>
   <?php
   include ("menu.html");
   ?>
<?php 

 

Change that to:

 

<?php
include ("header.html");
include ("menu.html");

 

No need to go in and out when doing multiple includes.

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.