Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeating Changing Navigation Links on Every Page 2

Status
Not open for further replies.

Yarcadian

Programmer
Mar 17, 2004
30
US
Hello,

I have a site that I use to showcase my woodworking hobby at where I have 19 pages of pictures with explanations. I will be adding another 5+ pages to the site and am tired of repeating the code for the links on each page and then re-publishing each page.

My Question:

How can I create a single place that holds the links to the gallery pages and attach that to each page once. So I can update only that one page with new links and upload just that one page when it changes?

Someone turned me onto CSS so I'm going to revamp my site and make it easier to modify. This piece would be a great first step toward that goal since it's what changes most often.

Thanks.....David
 
By the looks of it, your website host supports asp.net. This means you could use a server-side include command to include the contents of a file into your page... all done server-side resulting in exactly what you are after.

I'm no asp.net junkie... but you could try a little test and see if it works. Create 3 files - the first file is going to be the "navigation" file that is included in the other two files.

Create file called "navigation.txt" containing the following html code:
Code:
<div id="navigation">
<ul>
  <li><a href="[URL unfurl="true"]http://www.google.com">Google</a></li>[/URL]
  <li><a href="[URL unfurl="true"]http://www.yahoo.com">Yahoo</a></li>[/URL]
  <li><a href="[URL unfurl="true"]http://www.msn.com">MSN</a></li>[/URL]
</ul>
</div>

Now create a file called "page1.aspx" containing the following code:
Code:
<html><head>
<title>Page 1</title>
</head></body>
<h1>Test page</h1>
<p>Intro paragraph.</p>
[!]<!-- #include virtual="/navigation.txt" -->[/!]
<p>Concluding paragraph.</p>
</body></html>

And create a copy of the previous file, called "page2.aspx" and modify the title of the page from "Page 1" to "Page 2".

Now upload them all to (the top level - the root context of) your web host, and visit the fist page at - confirming that the "navigation" shows. Now visit the second page at and confirm that the "navigation" shows. If all is well, you will see the navigation.txt file contents being displayed on both pages.

Now, make a change to the navigation.txt file, upload it... and check the pages again.

Hope this helps!
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Jeff, that's exactly what I was looking for. Now I just need to change the other 19 pages to aspx, remove the bullets, and put them all on one line. I saw some CSS code that would be helpfull to that end.

Thanks again Jeff!

...David
 
I also was looking for something like this. Thanks for the explainatino... it works wonderfully easy!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top