PDA

View Full Version : Contractable Headers Script



TAGSAngel
03-29-2006, 03:04 PM
I've been using the contractable headers script at http://www.dynamicdrive.com/dynamicindex1/navigate2.htm
very happily for about 2 years now - on a frames page.

I have decided to switch to a non frames site and would like to use the same headers, however, when I try to use the script as an include page (within a cel on the page) it doesn't work. It stays open and all the formatting does not work.

Within it's own page, it works very nicely, but once I include it in a cel on a different page, it doesn't. Can anyone offer any simple help here (not very technically inclined)

Thanks
Angela

Twey
03-29-2006, 03:56 PM
Some of it needs to go in the head.

TAGSAngel
03-29-2006, 04:04 PM
Some of what? What am I missing here?

Twey
03-29-2006, 04:06 PM
The script. I'm presuming you're just including the whole page. This won't work, as you need to put a substantial amount of the script in the <head> of the page.

TAGSAngel
03-29-2006, 04:18 PM
Yeah, it took me a few minutes but I figured out what you were talking about. Problem is I'm using css too and I'd rather call the script then have it on every page. which is one of the reasons for having it in an include cel as opposed to part of the page.
Thanks for your reply though. Hopefully it will all get figured out at one point or another. One of the problems is I'm not proficient in any of it so you know what they say ...a little knowledge is dangerous.
I may be asking a lot of questions - hope you don't mind.

Twey
03-29-2006, 04:28 PM
I suggest you put the head part in one include, and the body part in another, and include them both.

TAGSAngel
03-29-2006, 04:36 PM
hmmmmmm If I'm understanding that right... That would mean double pages for all the body pages which is over 100
What I'm trying to have is a left navigation (the collapsable header script) which is included on all of my product pages. There will also be a right navigation but it wont be utilizing the script.

Twey
03-29-2006, 04:38 PM
hmmmmmm If I'm understanding that right... That would mean double pages for all the body pages which is over 100 You're not. You have only the code for the script that needs to go in the head in one page, and only the code for the script that needs to go in the body in another page. Then, you include these two pages on each of your "body" pages.

TAGSAngel
03-30-2006, 02:58 PM
OK.... I'm still not sure I understand but........ letting go of the css it seems that the collapsable script will not work unless it is in the page.
In other words.... leftnav.htm is where the collapsable header script is (I can't call it from a <script src > it wont work. It has to be in the leftnav.htm page

So now I put it in the lefnav.htm but the leftnav.htm is an include in the left most cel of a table on index.html The script wont work. The only way the script will work is if I put it in on index.html this is what needs to be changed. The script should only be in leftnav.html

Again it works fine when it's a frames site but it's not working with a non frames site when used as an include. Is it not going to work no matter what or is there something simple that I'm missing?

I have product scripts and add to cart scripts that will be on each page so in order not to cause a conflict and also not to make my pages cluttered with tons of code I really need this to work.

Thanks

Twey
03-30-2006, 03:20 PM
Is it not going to work no matter what or is there something simple that I'm missing?As I've said, the bit that needs to go in the <head> of your page needs to go in the <head> of your page. If you're using a single include to include the whole thing, this isn't going to happen. You need two included pages: one for the part in the head, the other for the part in the body.

TAGSAngel
03-30-2006, 03:31 PM
The part that belongs in the head is in the head. of the leftnav.htm and the part that's belongs in the body is in there again in the leftnav.htm If I have to put the script in the head of the index.html page too then basically it's not an include page is it?

But lets say that's the case.. and I keep the head script part in the head of index.html (and every other page on my site :-( ) now I have to put other scripts. that's going to cause a problem isn't it?

Angela

Twey
03-30-2006, 03:40 PM
Argh. I think you're missing something here. What it sounds like is that you have a whole HTML page, scripts and all, in leftnav.htm:
<html>
<head>
<script type="text/javascript">
// The "head" bit of the script
</script>
</head>
<body>
<script type="text/javascript">
// The "body" bit of the script
</script>
</body>
</html>And then you have another whole page in index.html (and all the other pages):
<html>
<head>
</head>
<body>
<!-- Include leftnav.htm here -->
</body>
</html>This won't work, because it means that the eventual output of index.html is:
<html>
<head>
</head>
<body>
<html>
<head>
<script type="text/javascript">
// The "head" bit of the script
</script>
</head>
<body>
<script type="text/javascript">
// The "body" bit of the script
</script>
</body>
</html>
</body>
</html>... which is very invalid HTML, but, more importantly, means that the "head" bit of the script isn't in the "real" (first) head. Instead, you need to have two includes:
<!-- leftnav-head.html -->
<script type="text/javascript">
// The "head" bit of the script
</script>
<!-- leftnav-body.html -->
<script type="text/javascript">
// The "body" bit of the script
</script>... and include them both in the correct positions in index.html:
<html>
<head>
<!-- Include leftnav-head.html here -->
</head>
<body>
<!-- Include leftnav-body.html here -->
</body>
</html>

TAGSAngel
03-30-2006, 03:49 PM
Ohhhhhhhhhhhhhhhhhhhhhh I didn't understand that at all when you were saying include 2 Hmmmmmm Very interesting. OK let me try that.
Thank you

TAGSAngel
03-30-2006, 04:09 PM
Nope that didn't work either. This is getting very frustrating. I'm sure you are equally as frustrated and I really appreciate your trying to help me.

Angela

Twey
03-30-2006, 04:21 PM
In that case:
HAHAHA fish.

TAGSAngel
03-30-2006, 06:24 PM
OK - this is my test site http://www.photogiftzone.com

index.htm works as I have the script in the head

testpage.htm is the page that has the two includes of navhead.htm and navbody.htm

testtotal.htm just has the whole leftnav.htm included

I even tried leftnav.htm (by itself, not included in anotherpage) by calling the script (head part in a .js file) and that didn't work either so it just appears that this script only wants to be resident and will not work any other way.

Angela

Twey
03-30-2006, 06:57 PM
it just appears that this script only wants to be resident and will not work any other way.It's got nothing to do with that. I've absolutely no idea what you're trying to do here. On testpage.htm, you haven't included anything, although you appear to be attempting to include both the head section and the body section in the body (I'm guessing that's what the <!-- webbot --> tags are all about). That simply looks as if it hasn't been parsed. However, you also seem to have put the body part of the script manually into testpage.htm. Also, both navbody.htm and navhead.htm contain <html>, <head> and <body> elements, which they shouldn't (as I explained earlier).
Also, there's some seriously bad markup and styling in those documents; see:
<b style="cursor:pointer; cursor:hand" onClick="expandcontent('sc1')" style=&{head};>I suggest you abandon FrontPage and create your page yourself. If you're looking for clean code, as you'd seem to be by fiddling with these includes, FrontPage is not the way to go.

TAGSAngel
03-30-2006, 07:24 PM
Well, you didn't say not to include the html tags but.... I tried it without them and that didn't work so I tried it with. I understand about the dirty front page code but unfortunately table positioning confuses me terribly. (as does all this)

I took off the html codes listed the includes as you have written them above made sure the navhead was within the <head></head> and the navbody.htm within the body tag.
And nothing happens. It doesn't even show up.

You showed me this
<b style="cursor:pointer; cursor:hand" onClick="expandcontent('sc1')" style=&{head};>

That's the way it's always been and since I am such a beginner at this, I don't know what's wrong so even though you do, merely showing it to me does not help. I have no clue what's wrong with it.

Again, I do appreciate your trying to help but please try and remember back to when you first started.

Thank you

Twey
03-30-2006, 07:55 PM
please try and remember back to when you first started.I was seven :-\
I think you may have had the right idea in the first place with the HTML structure. Having nosed around this, I believe that's what the tag="body" thing is for. In this case, you will need to change it to tag="head" for the purpose of the code in the head. However, this also means that you can use your single include, by including the different tags at different points like so:
<!-- webbot bot="include" tag="head" u-include="leftnav.htm" -->
</head>
<body>
<!-- webbot bot="include" tag="body" u-include="leftnav.htm" -->

m_coomer146
02-12-2008, 02:34 AM
<!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>
<title>Untitled Page</title>
script goes here
</head>
<body>
Controls go here
</body>
</html>

Twey
02-12-2008, 02:36 AM
This thread has been dead for two years...