Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.