Jump to content
Larry Ullman's Book Forums

Header.Html


Recommended Posts

'index.php', 'About' => 'about.php', 'Contact' => 'contact.php', 'Register' => 'register.php' ); // The page being viewed: $this_page = basename($_SERVER['PHP_SELF']); // Create each menu item: foreach ($pages as $k => $v) { // Start the item: echo '' . $k . ' '; } // End of FOREACH loop. ?>

 

Instead of text links being displayed on header.html, the above text is being displayed.

 

Ken

Link to comment
Share on other sites

Sorry, but that's not what I meant.

 

For example, please load your page into the browser, and from the browser's view source option, please copy the relevant HTML. Thank you.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

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

<title><?php // Use a default page title if one wasn't provided...

if (isset($page_title)) {

echo $page_title;

} else {

echo 'Knowledge is Power: And It Pays to Know';

}

?></title>

 

 

<link href="../css/styles.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="wrap">

<div class="header">

<!-- TITLE -->

<h1><a href="index.php">Knowledge is Power</a></h1>

 

<h2>and it pays to know</h2>

<!-- END TITLE -->

</div>

<div id="nav">

<ul>

<!-- MENU -->

<?php // Dynamically create header menus...

 

// Array of labels and pages (without extensions):

$pages = array (

'Home' => 'index.php',

'About' => 'about.php',

'Contact' => 'contact.php',

'Register' => 'register.php'

);

 

// The page being viewed:

$this_page = basename($_SERVER['PHP_SELF']);

 

// Create each menu item:

foreach ($pages as $k => $v) {

 

// Start the item:

echo '<li';

 

// Add the class if it's the current page:

if ($this_page == $v) echo ' class="selected"';

 

// Complete the item:

echo '><a href="' . $v . '"><span>' . $k . '</span></a></li>

 

';

 

} // End of FOREACH loop.

?>

<!-- END MENU -->

</ul>

</div>

<div class="page">

<div class="content">

 

<!-- CONTENT -->

Link to comment
Share on other sites

In the following line, you're assigning a class (as I suspected):

 

if ($this_page == $v) echo ' class="selected"';

 

Are you sure this isn't the issue with "Home" being blue?

 

<link href="../css/styles.css" rel="stylesheet" type="text/css" />
<style id='flashfirebugstyle' type='text/css'>object,embed{visibility:hidden !important;}</style></head>
<body>
<div id="wrap">
<div class="header">
	<!-- TITLE -->

	<h1><a href="index.php">Knowledge is Power</a></h1>
	<h2>and it pays to know</h2>
	<!-- END TITLE -->
</div>
<div id="nav">
	<ul>
		<!-- MENU -->
		<?php // Dynamically create header menus...

		// Array of labels and pages (without extensions):
		$pages = array (
			'Home' => 'index.php',
			'About' => 'about.php',
			'Contact' => 'contact.php',
			'Register' => 'register.php'
		);

		// The page being viewed:
		$this_page = basename($_SERVER['PHP_SELF']);

		// Create each menu item:
		foreach ($pages as $k => $v) {

			// Start the item:
			echo '<li';

			// Add the class if it's the current page:
			if ($this_page == $v) echo 'class="selected"';

			// Complete the item:
			echo '><a href="' . $v . '"><span>' . $k . '</span></a></li>

			';

		} // End of FOREACH loop.
		?>
		<!-- END MENU -->
	</ul>
</div>
<div class="page">
	<div class="content">

		<!-- CONTENT -->

 

Yes, it could be (class = "selected")-**blue text** kinda strange in code view, but I guess. But why are the codes being displayed vs the links and tabs (images). I have check several times too make sure that I have not left nothing out or mistype any codes. Then I just copied from source files and still get the codes displaying not the links and tab images. The page heading is displaying along with the color that's outline in the css file. I will troubleshoot some more, maybe I'm still doing something wrong.

Link to comment
Share on other sites

It has been a while since I did the first example in the book, so I don't remember well, but there are a number of files necessary for the site that Larry does not bother to talk about in the book, since they're very straightforward and distract from the point of the book.

 

Among these files are the CSS files and graphics. Larry mentions at a few points (I think) that you need to download the remaining code from this site to implement everything properly. He most likely has definitions in the CSS file(s) for including the necessary background images to make everything animate properly.

 

As for the code view in DW, I cannot comment. For all we know, it might be buggy, but it's probably just the missing images. Have you tried clicking on the other links (assuming you have the proper pages to be linked to) and seeing if the blue text changes to another tab?

Link to comment
Share on other sites

 Share

×
×
  • Create New...