Subject: Chapter Eight bold home link
Posted By: furnacelane Post Date: 9/16/2003 7:17:52 AM
I am having difficulties with this.

Code enclosed, cannot get 'Home' to bold.

I also, as a pointer do not get the message box on page 271 to appear.
When I create the library item it tells me that styles will not be included. I assume this is because the CSS styles are not selected as they are above the table code.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>GlobalSoccerEvents.com - Your Source for Soccer Events Around the Globe</title>
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<style type="text/css">
<!--
td {
    font-family: Arial, Helvetica, sans-serif;
    color: #000000;
}
a {
    font-family: Arial, Helvetica, sans-serif;
    color: #669933;
}
-->
</style>
</head>

<body>
<!-- #BeginLibraryItem "/Library/mainMenu.lbi" --><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../images/logo.gif" />&nbsp;</td>
    <td><table border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="../home.asp" id="home">Home</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="../events.asp" id="events">Events</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="../mySite" id="mysite">My Site</a></td>
  </tr>
</table></td>
  </tr>
</table>
<br />

<script language="JavaScript" type="text/javascript">
    var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
    sPageName = sPageName.substr(sPageName.lastIndexOf('/') _
                                                     + 1).toLowerCase();
    sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
    if (document.getElementsById(sPageName))
    {
        document.getElementById(sPageName).style.fontWeight = 'Bold';
        document.getElementById(sPageName).style.fontSize = '14pt';
    }
</script><!-- #EndLibraryItem --><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> <!-- TemplateBeginEditable name="Title" -->
    <td><h2>- Page Title Here -</h2></td>
    <!-- TemplateEndEditable --></tr>
  <tr> <!-- TemplateBeginEditable name="Content" -->
    <td>- Page Content Here -</td>
    <!-- TemplateEndEditable --></tr>
  <tr>
    <td align="center"><br /> <br /> <br /> <br /> <br />
      <!-- TemplateBeginEditable name="Footer" -->- Footer Here -<!-- TemplateEndEditable --></td>
  </tr>
</table>
</body>
</html>
Reply By: Imar Reply Date: 9/16/2003 7:38:20 AM
Hi there,

The problem you have is caused by a print error in the book. Take a look at the following line:

sPageName = sPageName.substr(sPageName.lastIndexOf('/') _
                   + 1).toLowerCase();

The underscore is a VB Script way to break up a line, and not a JavaScript one. Change it to this:

sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowerCase();

This should all be on one line.......

Take a look at the errata section for other errors that have been discovered after the book was published.

The warning about the style is correct. You copy just the menu code and not the style definition to the Library Item. Since DW cannot guarantee that you are reusing the Library Item on another page with the exact same style definition, it warns you that it might end up look different. No problem, you can simply click OK. The styles will be used throughout TheSoccerSite consistently, so it's no problem here.

Regards,

Imar




---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: furnacelane Reply Date: 9/17/2003 5:18:41 AM
Thanks Imar, the code now works; sorry did not see the errata.
Just as an aside, but not too important, any idea why I do not get the message box from page 271 appear?

Reply By: Imar Reply Date: 9/17/2003 6:23:51 AM
Hi,

I don't have the book here right now, so I am not sure what the problem is. You either have to wait a couple of hours till I am at home, or post the code here so I can take a look at it.

Cheers,


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: Imar Reply Date: 9/17/2003 11:21:55 AM
OK, back home with the book. I have seen the error message on page 271.

The error message tells you about placing an editable region inside a <p> or other block tag. I think the only reason you don't get that message is because you haven't placed the editable region in a block tag (duh ;-)  )

If you look at the code you'll see this:

<!-- TemplateBeginEditable name="Title" --> 
    <td><h2>- Page Title Here -</h2></td>
    <!-- TemplateEndEditable --
As you can see, not just the <h2> is inside the editable region, but the entire <td> with the <h2> is. Step 5 on page 263 instructs you to select the entire contents of the table cell in Design View. When you do that, Dreamweaver will just select the contents of the <h2> tag. If you then apply the editable region, this is what you'll end up with:

<td><h2>
<!-- TemplateBeginEditable name="Title" -->
- Page Title Here -
<!-- TemplateEndEditable -->
</h2></td>
The advantage of this, is that the users of your template can no longer delete or change the <h2> or <td> tags. All they can do is change the actual title. This will ensure a consistent look in your site.

Does this make sense? If not, please let me know.

Cheers,


Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: furnacelane Reply Date: 9/18/2003 4:55:22 AM
Imar, you're a god.
Everything works wonderfully.
Once again thanks for your help and I
apologise for being new to the subject.

Reply By: Imar Reply Date: 9/18/2003 6:20:16 AM
There is no reason to apologize for being new to a subject. How, else, can anybody ever learn a new topic?

Glad it worked, and if you have other issues with the book or Dreamweaver, please post them here.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Go to topic 4255

Return to index page 1043
Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034