Reply
Linking to a page with Frames
Old 09-07-2006, 03:58 PM Linking to a page with Frames
Junior Talker

Posts: 1
Name: Ken
I'm not sure if my question belongs here in the html forums but I'll ask anyways. I'm trying to link to a page within a page. However, there is a menu frame which loads when first loading the main page on the left side. My question is when I link just the page I want, there are no menus and it's akwards to navigate back to the main site. Is there anyways to make the menu show on the linked page? I'm not sure if this is a problem with the way my site is setup, of if there is even a way around it.


Thanks again
usernameken is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 09-07-2006, 06:00 PM Re: Linking to a page with Frames
Extreme Talker

Posts: 177
I think there are several ways of doing this. You could use a scripting language, like PHP to parse the URL path and if it is not the main page which includes the <frameset> then you could redirect it to there, and make the right hand frame load the page you wanted. You might be able to accomplish the same thing tweaking the .htaccess file.

If you decide to go the PHP route, this might get you started. (untested)

index.php
Code:
<frameset>
   <frame name="left" src="navmenu.php">
   <frame name="left" src="<?=$_GET["page"];?>">
</frameset>
checkframe.php
Code:
<?
   if ($_SERVER["PHP_SELF"] !== "/index.php") {
     header("Location: http://www.yourdomain.com?page=".$_SERVER["PHP_SELF"]);
   }
?>
and at the beginning of every other page:
Code:
<?
   include "checkframe.php";
?>
At the very least, this should get some people to give you some better answers.
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 01:02 AM Re: Linking to a page with Frames
vangogh's Avatar
Post Impressionist

Posts: 8,825
Name: Steven Bradley
Location: Boulder, Colorado
When the frame was created you should have given them names. the frame with the menu might have name="menu" and the frame with the content might have name="content"

The with your links you would want to specify a target="content"

The target is saying load the new page in the frame with the name content. First make sure your frames have names

<frameset cols="25%,75%">
<frame src="menu.htm" name="menu">
<frame src="myhomepage.htm" name="content">
</frameset>

and then make sure the links in your menu file have the target attribute

<a href="mynewpage.htm" target="content">See My New Page</a>

The better option though is not to use frames at all since there are several problems associated with them like a lack of search visibility and an inability to bookmark specific pages. The better approach would be to recode the site and use a server side language like PHP or ASP to accomplish the same thing as the frames are doing. If you'd like to learn the server side scripting way let me know and I'll be happy to go over the basics and point you to a few resources for more info.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum

Last edited by vangogh : 09-08-2006 at 01:05 AM.
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 09-08-2006, 02:02 PM Re: Linking to a page with Frames
Extreme Talker

Posts: 177
There's the "better" answer I was talking about. Thanks vangogh.

With my careless typing, I forgot to name the frames differently and to add cols or rows to the frameset.

I knew someone would point him away from frames. While it's easy to see the usefulness of them, it doesn't take long before seeing all the things that aren't so great about them.
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 05:48 PM Re: Linking to a page with Frames
vangogh's Avatar
Post Impressionist

Posts: 8,825
Name: Steven Bradley
Location: Boulder, Colorado
It is easy to see why people can be drawn to frames and having to edit only one menu.html file instead of every page of a site. The thinking is good, but frames add too many additional problems.

I know server side scripting can scare some people, but the amount needed to include other files is very simple and only a small amount of knowledge is needed.

A basic understanding of what a scripting language is would help and you do need to have that language installed on your server. You'll most likely need to change your file extensions from .html to .php (assuming php is the language you're using)

To include the file though is just a simple line of code embeded in you page:

<?php include "pathToFileToInclude" ?>

It's just as simple using a language like ASP as well.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Linking to a page with Frames
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14697 seconds with 12 queries