Jump to content

Link Targeting?


Guest SoundSev3n

Recommended Posts

Guest SoundSev3n

I'm not entirely certain how to ask for what I have in mind. Which made Google a difficult tool to use in this case.

 

 

I have a page with a left-set "navigation" DIV and a "right" DIV.

How can I get links in "navigation" to open their referenced pages IN the "right" DIV?

 

 

[i've found that this is a commonly asked question through google but i found several different answers in the form of codes people posted in responce to this and similar questions. i figured i'd best describe what i'm looking for while i was here at this site to get a better answer. i don't just want a code thrown at me, i would like to know how/why it works as well]

 

Thanks in advance for any help you can give!

Link to comment
Share on other sites

I think what your looking to do is to have your navigation in a

that you would float: left;. Then have the main content of your page to the right. If so, create a
for the main content and set the left-margin to where it will clear the right margin of the float left area. Your navigation will be the same on each page, but the main content will change.

 

eg. if your float left area is 300px wide, you need to set the left-margin of the main content to at least 300px and set your left-padding to meet your needs. You may have to wrap all in a

and set the width of the wrapper and the float:left;. I believe this is the basis of what your looking for - hope it helps.
Link to comment
Share on other sites

I think Soundsev is talking about frames. And now that I've said the ''F' Word, forget about it really fast. There are dozens of reasons why not to use frames, and not a single good one to support it.

 

Instead of them, use PHP includes for the parts of your site that repeat (like your header, navigation, and footer, most likely) and don't worry about reloading those sections.

 

http://www.killersites.com/mvnforum/mvnforum/viewthread_thread,4258

 

http://www.killerphp.com/videos/02_php_includes/02_php_includes.html

Link to comment
Share on other sites

We are all assuming that your left div navigation is always the same.

 

There are two completely different ways to do this, completely opposite procedures.

 

Framesets; not recommended and out of fashion now; the frameset and left frame are always the same but the right frame has different html pages targetted from the left frame.

 

PHP "includes"; the main pages are all different pages with different main content. The left navigation is included in a separate "include" file so that you only have to edit one file if you change a link and it's inserted into every main page with PHP code. When you say "How can I get links in "navigation" to open their referenced pages IN the "right" DIV?" the right div is the whole page, several of them with different content, then the left div is the one inserted IN every other page.

 

Form one page complete in the normal way with the menu and check that it validates and displays properly.

 

Open up Notepad or a text editor (not Word) and cut the code that repeats in every page completely (as much or as little as you want, without doctype, html, head or body tags) and paste it into Notepad and save as an "include" file called menu.inc. You then have only one file to edit if the menu changes.

 

Substitute the code you have cut out with PHP code

<?php include ("menu.inc"); ?>

in the main file and save it with .php filename extension instead of .html or .htm.

Do the same with other main pages where the menu repeats and name them with .php extension.

 

You can use .txt, .php, .html or .htm for the "include" file but it distinguishes it as an "include" file in your file list if you use .inc as the filename extension and it's even better if you put all "include" files in a different directory/folder.

 

If you use a complete page as an "include" file with .html or .htm for the filename extension the final processed page will have two doctypes, two html tags, two head sections, etc. in an unusual place which is not a good idea so only put the menu code (say the li tags if formed as a list) in the menu.inc file.

 

You can have different "include" files on the same main pages for header and footer and even use "includes" for the parts of the head section that repeat.

 

The PHP code needs to be processed by a server before the result can be seen, either by the hosting service's server just before downloading or by a server like WampServer 2 (which includes Apache) on your computer for local viewing.

 

SHTML works the same way but the "include" file must have .txt filename extension and the main pages have the code and the .shtml filename extension.

 

Check that your hosting service supports PHP or SHTML as free webspaces provided by ISPs usually do not.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...