...

View Full Version : SSI: Navigation Menu Links



gmag73
02-05-2012, 07:17 AM
Will someone please tell me what I am doing wrong here?


With the below code, my nav menu is showing both linked and unlinked items next to each other, whether I am on the page or not. So it looks like this on each page:

Home Home (http://anysite.com)
Services and Pricing Services and Pricing (http://anysite.com/services)
Downloads Downloads (http://anysite.com/downloads)



<body>
<!--#if expr="\"$DOCUMENT_URI\" = \"/content_copy.shtml\""-->
Home
<!--#else-->
<a href="content_copy.shtml">Home</a>
<!--#endif-->
<br />
<!--#if expr="\"$DOCUMENT_URI\" = \"/services.shtml\""-->
Services and Pricing
<!--#else-->
<a href="services.shtml">Services and Pricing</a>
<!--#endif-->
<br />
<!--#if expr="\"$DOCUMENT_URI\" = \"/downloads.shtml\""-->
Downloads
<!--#else-->
<a href="downloads.shtml">Downloads</a>
<!--#endif-->
<br />
<a href="http://www.facebook.com/gregscomputerworks" target="_blank">Facebook Page</a>
<br />
<!--#if expr="\"$DOCUMENT_URI\" = \"/contact.shtml\""-->
Contact Greg
<!--#else-->
<a href="contact.shtml">Contact Greg</a>
<!--#endif-->

</body>


Please help!

abduraooft
02-06-2012, 07:19 AM
Sorry, your question is not clear.

gmag73
02-06-2012, 04:13 PM
Sorry...

My nav menu is showing double items with that code (it looks exactly the same on every page I navigate to...Home, Services and Pricing, Downloads):


Home Home (http://anysite/com)
Services and Pricing Services and Pricing (http://anysite/com/services)
Downloads Downloads (http://anysite/com/downloads)

...but I want it to look like this (when on the Home page):

Home
Services and Pricing (http://anysite/com/services)
Downloads (http://anysite/com/downloads)

Hope that helps...

tracknut
02-06-2012, 05:40 PM
Looks like it would do that if none of your code was interpreted through SSI (ie, if all those html comments were just treated as comments). Is the file you're processing named something.shtml, and have you verified SSI is actually working on the server?

Dave

gmag73
02-07-2012, 05:47 AM
Looks like it would do that if none of your code was interpreted through SSI (ie, if all those html comments were just treated as comments). Is the file you're processing named something.shtml, and have you verified SSI is actually working on the server?

Dave

Good eye...I'll bet you're right. I do know SSI is working on the server, so I will check the file extensions. Thanks.

EDIT: Nope, file types look ok to me. I even skipped the "include file" command and pasted the code directly into the .shtml (it WAS part of a .txt that was referenced with the "include file" SSI command). The Nav bar I am using as an SSI is a cell in a table in the main .shtml doc...would that have any effect?

tracknut
02-07-2012, 04:07 PM
Can you give us a link to the actual live web page?

Dave

gmag73
02-07-2012, 05:06 PM
Can you give us a link to the actual live web page?

Dave

Sure thing...

http://www.gregscomputerworks.com/content_copy2.shtml

Note that the links in the left Nav bar do not work yet, as I have not uploaded those target pages (the shtml versions), but the links in the main body do work.

tracknut
02-07-2012, 05:27 PM
Well I see three things right off...
1. you have multiple html pages glued together here, repeating things like doctype, <body> etc. I think your included navigation code has all that in there, and it can't. So that stuff needs to be pulled out.
2. Clearly SSI is NOT interpreting the various comments, I'm not exactly sure why
3. You have a missing ">" here:


<div align="center"><img src="Frustrated 145x175.jpg" width="100%" alt="Frustrated" title="" border="0" />
<img src="Help 146x65.jpg" width="100%" alt="Help!" title="" border="0" /></div>


Maybe one of those will fix it...
Dave

gmag73
02-08-2012, 03:21 AM
Well I see three things right off...
1. you have multiple html pages glued together here, repeating things like doctype, <body> etc. I think your included navigation code has all that in there, and it can't. So that stuff needs to be pulled out.
2. Clearly SSI is NOT interpreting the various comments, I'm not exactly sure why
3. You have a missing ">" here:


<div align="center"><img src="Frustrated 145x175.jpg" width="100%" alt="Frustrated" title="" border="0" />
<img src="Help 146x65.jpg" width="100%" alt="Help!" title="" border="0" /></div>


Maybe one of those will fix it...
Dave

Thanks for the pointers. There are 3 separate documents being pooled to make this webpage, so that's why it looks like so many tags are doubled...the "view source" is pulling them all:

One document is the left column of the table, and that document is targeting via SSI the second document for the nav menu, and the third document is the second column of the table.

I don't know what I am doing apparently lol...back to frames I guess :(

tracknut
02-08-2012, 03:48 AM
Ack, no, not back to frames!

Just remove all the extraneous code. The net result, after the includes have happened, is a full html page with one body, etc. So in the files that are being included, you only put the literal code you want to include. It isn't a "web page" that you're including, it is a "chunk of code" that you want inserted in a spot.

Make sense?
Dave

gmag73
02-08-2012, 06:14 AM
Ack, no, not back to frames!

Just remove all the extraneous code. The net result, after the includes have happened, is a full html page with one body, etc. So in the files that are being included, you only put the literal code you want to include. It isn't a "web page" that you're including, it is a "chunk of code" that you want inserted in a spot.

Make sense?
Dave

Oh ok...let me try that...thank you so much for your patience!

gmag73
02-08-2012, 06:25 AM
Ugh this is frustrating! I did what you said (which makes total sense, btw), but with no change. I (successfully) tested SSI on my host server with this tutorial:

Make two files. Name the first file mytest.shtml and the second file myssi.txt

The content of the mytest.shtml is:

<html><body>It goes here.
<!--#include file="myssi.txt"-->
</body></html>
The content of the myssi.txt is:

<font size="+2">
<b>Here I am!</b>
</font>
Upload those two files to your server and put the URL of mytest.html into your browser. If you see the words "It goes here. Here I am!", then you can use SSI on your server.

You can see the successful result here:
http://www.gregscomputerworks.com/mytest.shtml

Still no change athttp://www.gregscomputerworks.com/content_copy2.shtml, though :(

tracknut
02-08-2012, 04:55 PM
I've been doing a bit of reading on SSI (I don't use it, personally), and noticed that the "control directives" (the #if and #set) are not part of the original SSI, but are an extension called XSSI provided in Apache v1.2+ servers. Do you know what server you're running?

Dave

gmag73
02-08-2012, 06:51 PM
I sure don't but I will find out. Would you be willing to go to www.gregscomputerworks.com, and tell me how I can get a similar layout without frames?

Thanks so much!
Greg

tracknut
02-08-2012, 06:57 PM
I sure don't but I will find out. Would you be willing to go to www.gregscomputerworks.com, and tell me how I can get a similar layout without frames?

Thanks so much!
Greg

PHP, that's what all the cool guys use :)

Your files would be xxxx.php instead of shtml of course, but here's the gist of it:


<?php
if ($_SERVER['REQUEST_URI'] == "/content_copy.shtml")
echo "Home";
else
echo '<a href="content_copy.shtml">Home</a>';
?>

Dave

gmag73
02-08-2012, 10:57 PM
Ok cool...how would I create a navigation bar? Would I put that code into a column of a table or something?

tracknut
02-09-2012, 01:09 AM
Just like you did in your current code, you could simply list all your links with <br> separating them. There are higher-tech ways to do it, but that's unrelated to this particular discussion. So then you have a list of your nav items, and you put it all in one file, called nav.inc or so. It essentially looks like the code I gave you, but again it should be stripped of all the doctype, head, body, etc stuff.

Then in each of your site pages, you'd have a line like:


<?php include ("nav.inc"); ?>

wherever you want the nav included (ie, probably a <div> on the left side of the page).

That should do it.
Dave



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum