This is a discussion on "using a div like a frame to display other web pages" within the Web Page Design section. This forum, and the thread "using a div like a frame to display other web pages are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
using a div like a frame to display other web pages
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
using a div like a frame to display other web pages
Im fairly new to css but prefer it to html for standard formatting.
I have a standard web page layout for my home page and have created using many divs in the page. My menu (in css) goes down the left and I would like to link to other pages but keep the menu displayed whilst viewing the new link and without coding the menu into the new pages. how can I achieve this without using a frame in my page? |
|
|
|
|||
|
Re: using a div like a frame to display other web pages
Glad to hear you are an enthusiast of standards. To do what you want, place the code for your menu in a seperate file, e.g., navigation.inc. In your page template, inside the div that is to contain the navigation, use an include statement to pull in the file containing the navigation code. You can use as an example, depending on what you have available to you: <?php include ('navigation.inc'); ?> - PHP method <!--#include file='navigation.inc'--> - SSI method Note that with the SSI syntax, it's important not to have a space between the <!-- and the #. |
|
|||
|
Re: using a div like a frame to display other web pages
hi,
ive never used php before but just had a quick try and looked around for more info on it. tried your code and found a site with simple php coding and I cant get this to work. it displays all other text in the htm but does not seem to look up the php code here is my example htm: <!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" lang="en" xml:lang="en"> <head> <title>This is my page!</title> </head> <body> HTML code... <? include("nav.inc"); ?> ...HTML code... </body> </html> here are my nav.inc file contents: <table class="nav"> <tr> <td><a href="/" title="Home page">Home</a></td> <td><a href="/computers/" title="Everything about computers">Computers</a></td> ... <td><a href="/recipes/" title="My favorite recipes">Recipes</a></td> </tr> </table> Ive tried viewing this in both ie and firefox, am I missing something simple? |
|
|||
|
Re: using a div like a frame to display other web pages
If you store your pages as .html files, and I recommend that you do, then the server needs to be told that they contain php code that needs parsing. You do this by adding the following line to your server's .htaccess file.
|
|
||||
|
Re: using a div like a frame to display other web pages
PHP is a better method, but to get the "frames" effect, you'd need to use AJAX. It's fairly complicated, but there are several scripts available for you to use. PHP is a better solution, but it will reload the pages entirely. If that's not what you want, here's an example script:
http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm |
|
|||
|
Re: using a div like a frame to display other web pages
Quote:
All this talk about the 'frames' effect and AJAX is only likely to confuse them. |
|
|||
|
Re: using a div like a frame to display other web pages
many thanks for your replies.
the ajax code is complicated but works very well. the php does look much easier but Im a bit unsure on getting it set up. Im not a good web coder and am unsure about the access files as suggested. therefore Im going with the ajax code as it works really well once set up. many thanks - good advice from both much appreciated!!! |
![]() |
| Tags |
| using, div, frame, display, other, web, pages |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EASY PEASY Displaying frame address in another frame question | molotov | JavaScript Forum | 3 | Nov 20th, 2007 17:29 |
| Javascript - Updating web pages with snippets from other pages | Ydot | JavaScript Forum | 3 | Jul 10th, 2007 14:38 |
| Displaying pages in a frame | smokeythebear | JavaScript Forum | 1 | Dec 25th, 2006 09:44 |
| <frame> | Fox | Web Page Design | 1 | Aug 26th, 2005 20:58 |
| Scripting Needed(adding pages to pages) | Amari | Classic ASP | 1 | Sep 4th, 2004 18:06 |