using a div like a frame to display other web pages

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.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 31st, 2006, 13:31
New Member
Join Date: Aug 2006
Location: lancashire
Age: 33
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote

  #2 (permalink)  
Old Aug 31st, 2006, 13:56
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
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 #.
Reply With Quote
  #3 (permalink)  
Old Aug 31st, 2006, 14:32
New Member
Join Date: Aug 2006
Location: lancashire
Age: 33
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote
  #4 (permalink)  
Old Aug 31st, 2006, 14:44
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
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.
Code: Select all
AddType application/x-httpd-php .html .php .shtml .txt
This is telling the server to treat any files of the extensions given as possibly containing php code.

Reply With Quote
  #5 (permalink)  
Old Aug 31st, 2006, 15:17
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #6 (permalink)  
Old Aug 31st, 2006, 15:23
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: using a div like a frame to display other web pages

Quote:
Originally Posted by ryanfait View Post
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
I could be wrong but I think you are missing the point of what the originator of the thread was asking.

All this talk about the 'frames' effect and AJAX is only likely to confuse them.
Reply With Quote
  #7 (permalink)  
Old Aug 31st, 2006, 18:28
New Member
Join Date: Aug 2006
Location: lancashire
Age: 33
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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!!!
Reply With Quote
Reply

Tags
using, div, frame, display, other, web, pages

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 16:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43