|
||||||||||||||||||||||||
Server Side Include (HTML in HTML)
Hey guys i am developing a site in which i want the main logo & the navigation bar & the side menu to be the same in all the 100 's of pages i will write. (This is because i have to add a new topic everyday!.)
The steps i took :
1. I used dreamweaver to build this project.
2. I created a file :-
in which i wrote html containing header, menu, navigation bar,etc.
3. Now i included the a.shtml file in a sample file, say
.
To do this i gave the following code in the head of sample.shtml.
It worked & the contents of a.shtml can be viewed in sample.html (only in dreamweaver not in browser because SSI cammands dont work with any browser)
The tragedy begins
4. Now i want to edit sample.html further containg the details of the product.
But i was not able to do this.
What i want from you
1. Is thr any other way for keeping my menu navigation, haeder same throughout the site
2. Can we preview the ssi pages is brower
3. Why i am not able to edit sample.html further.
The steps i took :
1. I used dreamweaver to build this project.
2. I created a file :-
| Quote: |
| a.shtml |
3. Now i included the a.shtml file in a sample file, say
| Quote: |
| sample.html |
To do this i gave the following code in the head of sample.shtml.
| Code: |
| <!--#include virtual="/a.shtml" --> |
It worked & the contents of a.shtml can be viewed in sample.html (only in dreamweaver not in browser because SSI cammands dont work with any browser)
The tragedy begins
4. Now i want to edit sample.html further containg the details of the product.
But i was not able to do this.
What i want from you
1. Is thr any other way for keeping my menu navigation, haeder same throughout the site
2. Can we preview the ssi pages is brower
3. Why i am not able to edit sample.html further.
If your host supports php (Frihost does) then you should use this:
This will include everything in the file. For example:
In FILENAME.html I have:
then the place where you put that code would have somewhere:
.
| Code: |
| <?php
include('FILENAME.html'); ?> |
This will include everything in the file. For example:
In FILENAME.html I have:
| Code: |
| HI! |
then the place where you put that code would have somewhere:
| Code: |
| HI! |
PHP is not good to include full HTML in other HTML because in that case you will have doubled tags (HTML and BODY) what is not good type of coding. I am prefer iframe for HTML pages and PHP for PHP or part of HTML code (but not full).
Sonam
| Code: |
| <IFRAME NAME="someName" WIDTH="500" HEIGHT="50" MARGINWIDTH="0" MARGINHEIGHT="0" SRC="someFile.html" SCROLLING="no" FRAMEBORDER="no"> </IFRAME> |
Sonam
Ah yes, totally forgot about the Iframe. Yah thats also possible. Thanks for reminding me.
ya thank you all but is thr any way to see included pages in any browser.
And my second question :- is it possible to maintain menus & header by any other way!
And my second question :- is it possible to maintain menus & header by any other way!
I frame canot be use for menu! Because when we include a menu using i frame, & when some1 click on the link in menu that page gets open in the frame only, not on the browser!
A am not sure but this problem is in target. Try in menu for <a > definition set:
target = "_top"
Sonam
P.S.
You don't need big reed letters for your questions.
target = "_top"
Sonam
P.S.
You don't need big reed letters for your questions.
| gr8ankit wrote: |
| I frame canot be use for menu! Because when we include a menu using i frame, & when some1 click on the link in menu that page gets open in the frame only, not on the browser! |
You should be careful about using an iframe to display a menu, particularly as if the menu has drop downs, the dropdown will not appear outside the confines of the frame it is placed in. This is a classic case for using SSI.
HTML PAGE WILL BE SOMETHING LIKE THIS
| Code: |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Strict</title> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div id="header"> Header </div> <div id="nav"> <?php include("nav.php"); ?> </div> <div id="content"> COntent </div> </body> </html> |
and your nav.php page will be something like this
| Code: |
|
<ul id="nav_list"> <li><a href="home.html">Home</a></li> <li><a href="about.html">About Me</a></li> <li><a href="stuff.html">Stuff</a></li> <li><a href="contact.html">Contact</a></li> </ul> |
I believe the page from which you are including files from (sample.html), requires a .shtml suffix.
| mathiaus wrote: |
| I believe the page from which you are including files from (sample.html), requires a .shtml suffix. |
I didn't know that I have to say. I though you could include any type of file, including simple text files. Having said that, I've only actively used ASP SSIs as I have never had a host that supports PHP before.
I don't like using iframes for including in this way, mainly because of the cross browser issues with setting zero borders on an iframe.
| Code: |
| 2. I created a file :- Quote:
a.shtml in which i wrote html containing header, menu, navigation bar,etc. 3. Now i included the a.shtml file in a sample file, say Quote: sample.html |
gr8ankit didn't exactly explain what hi/she want. Of course if he/she have drop down menu it is not good to use iframe. I have idea that he/she want to include full html page in other html page (template).
Sonam
| sonam wrote: |
| PHP is not good to include full HTML in other HTML because in that case you will have doubled tags (HTML and BODY) what is not good type of coding. |
I use the php include function and there is no problem at all. If you don't want doubled tags just code the included file in php
| Quote: |
| I use the php include function and there is no problem at all. If you don't want doubled tags just code the included file in php |
I know it is possible to include part of HTML to another page without any problem, but gr8ankit asking for including full HTML page (how I understand his question).
Sonam
There shouldn't be a problem having "double tagging" as you call it, because in the page itself, only the iframe tag will show. That really isn't anything to worry about
Also, I usally never include my <body> and <html> in my .php codes, thats if im using
I don't think this really makes a difference. But, my php codes work anyways.
| Code: |
| <php include('filename.php'); ?> |
I don't think this really makes a difference. But, my php codes work anyways.
Hey thank you all. I read all the topics, now i got the final solution to it.
My problem was updating the navigation bars! I solved it by making them in flash, now i dont need the above techniques. Now if i want to update my menus, i just have to upload the swf file to the server & all my pages will be updated with a sin gle file. Still very thankful to you all.
My problem was updating the navigation bars! I solved it by making them in flash, now i dont need the above techniques. Now if i want to update my menus, i just have to upload the swf file to the server & all my pages will be updated with a sin gle file. Still very thankful to you all.
thnx!!!!!!!!!!
