Posted: Fri Jun 01, 2007 5:12 am Adding a .shtml menu to save time.
Hi guys,
I am fairly new to HTML and am working off my own head learning from the internet. I have built a website with various pages using basic HTML. I have been adding code to every page for my menu to appear on every page exactly the same.
I have since heard that by using the .shtml command I could do away with this code on every page and just include the mainmenu.shtml file instead.
My host does accept .shtml files so I am ok to use them.
Now the problem lies when trying to find exactly what to type and how to save my menu file.
I have cut and pasted my old menu code from my index file into a new notepad page and named it mainmenu.shtml (is this correct)?
Then I have inserted this command on my index page where my menu code used to be, <!--#include virtual="/mainmenu.shtml" -->
Should I now save my index as a .shtml file? Should I rename all the other files in my pages from .html to .shtml?
Any advice would be welcome as I am pulling my hair out here.
Cheers.
By the way the website is www.freebidz.co.uk, I know the layout is a mess but as I am learning I will get there in the end.
You should be able to name you file mainmenu.html - it does not need to be named shtml (I don't recommend it to be named shtml because that will be parsed as well). Sometimes some hosting companies require you to use .inc or .txt files for file includes instead.
The only file name that needs to have the shtml extension would be the one that contains the code
I have tried again but still no joy. I have tried using both file incude and virtual include. Not sure what the difference is but neither are working as yet.
I get my main content to work but at the top of the screen it has <--#include file="/mainmenu.html" -->
My index file is the one with the code in so I renamed that index.shtml, here is a portion of my code to show you what I have done.
<table width="1000">
<!--Main Menu insert-->
<!--#include file="/mainmenu.html" -->
<!-- Main Body -->
<td width="800" valign="top" bgcolor="#000CCC" align="center"><align="left"><img src="http://www.freebidz.co.uk/images/carling.jpg"><img src="http://www.freebidz.co.uk/freebidz/images/CLUB HEADER.jpg ">
<align="right"><img src="http://www.freebidz.co.uk/images/carling.jpg">
<br>The best watering hole in town!
<BR><font color=yellow>The best entertainment in town!
<br><font color=orange>The best place to socialise - FULL STOP!
Joined: 15 May 2004 Posts: 8267 Location: Castle Rock CO USA
Posted: Sat Jun 02, 2007 4:41 am
If you use
Code:
/mainmenu.html
this is a virtual link and you need to use the virtual include. So
Code:
<!--#include file="/mainmenu.html" -->
should be
Code:
<!--#include virtual="/mainmenu.html" -->
or
Code:
<!--#include file="mainmenu.html" -->
Assuming the mainmenu.html is in the same folder as index.shtml
Also remember - some hosting companies might require you to have include files as inc or txt instead of HTML. You might want to also write up a support ticket as well to confirm
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum