Results 1 to 10 of 10
-
03-21-2004, 06:37 AM #1Junior Guru Wannabe
- Join Date
- Mar 2003
- Posts
- 70
Sidebar? include code? Help please!
I am re-designing my website. I am not some very good web designer so I do it in plain html. This time, I have gotten into a problem. I want to have a sidebar menu for all my pages. But I want it to be in some sort of "include" method so that when I edit the sidebar menu page, all others get updated automatically.
I have done this for the header and footer but I don't know how to do it for the sidebar. Can anyone help me out? Please!
-
03-21-2004, 08:32 AM #2Junior Guru Wannabe
- Join Date
- Mar 2003
- Posts
- 70
come on guys... it must be a piece of cake for u guys.... please let me know about it ASAP
-
03-21-2004, 09:06 AM #3Junior Guru
- Join Date
- Apr 2002
- Location
- Southern Maryland
- Posts
- 246
Do you mean this?
Code:<div id="sidebar"> <?php include("/path/to/your/sidebar.php"); ?> </div>
-
03-21-2004, 09:37 AM #4Junior Guru Wannabe
- Join Date
- Mar 2003
- Posts
- 70
is dat in html or php?
i want an html code...
-
03-21-2004, 09:39 AM #5Junior Guru
- Join Date
- Apr 2002
- Location
- Southern Maryland
- Posts
- 246
It's for a php include, but you can use it in an html document.
-
03-21-2004, 09:58 AM #6Junior Guru Wannabe
- Join Date
- Mar 2003
- Posts
- 70
oh thanks... can you please tell me the html include one? If you don't know it, I'll try figuring this out but if you do, please let me know because this one is a bit confusing
-
03-21-2004, 11:35 AM #7Junior Guru
- Join Date
- Apr 2002
- Location
- Southern Maryland
- Posts
- 246
Sure, first make your sidebar.php file in a .txt (Notepad) file. Then, put the following in your .html document where you want the sidebar.php to show up:
Code:<?php include("/path/to/your/sidebar.php"); ?>
/home/username/public_html
This will only work if your host supports PHP though.
-
03-21-2004, 12:47 PM #8Texan at Heart
- Join Date
- Jul 2003
- Location
- Castle Pines, CO
- Posts
- 7,189
You also might consider SSI - server side includes. You save your main page with SHTML or SHTM. This tells the server to parse this file before delivering it to the browsers. 99% of all hosts support SSI
More information:
http://www.bignosebird.com/ssi.shtml
http://www.smartwebby.com/web_site_d...e_includes.asp
-
03-22-2004, 08:14 AM #9Junior Guru Wannabe
- Join Date
- Mar 2003
- Posts
- 70
You mean I can code, etc my page in html put just rename it to .shtml or .shtm?
By the way, thanks a lot you guys. I have figured out how to do it now and yes, my server supports php and SSI both.
-
03-22-2004, 09:27 AM #10Junior Guru
- Join Date
- Apr 2002
- Location
- Southern Maryland
- Posts
- 246
You are welcome...glad you have it figured out.