Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding

Reply
 
LinkBack Thread Tools
Old 09-13-06   #1 (permalink)
Intel Overclocker
 
StepsAscend's Avatar
 
intel ati

Join Date: Jul 2005
Posts: 1,208

Rep: 33 StepsAscend is acknowledged by some
Unique Rep: 33
Folding Team Rank: 1789
Trader Rating: 0
Default Nav Menu for all pages of site

I'm new to all this, but I'm making a personal website for a class. I've found some code for a really great javascript nav menu to go on the left side of my page. I want this on every page, but I don't want to have to update each individual file each time I add an item to the menu. What is the best way to achieve this?
__________________
System: Wolfdale
CPU
E5200 @ 3.6 GHz
Motherboard
ASRock P43TWINS1600
Memory
4GB Super Talent
Graphics Card
Radeon HD4670
Hard Drive
1TB Caviar Black, Caviar 250GB
Sound Card
X-Fi Extrememusic
Power Supply
Antec Smartpower 500
Case
Antec Solo
CPU cooling
Stock
GPU cooling
Stock
OS
Windows 7 x64, Vista 32
Monitor
Viewsonic 20" WS
StepsAscend is offline I fold for Overclock.net   Reply With Quote
Old 09-13-06   #2 (permalink)
makin' the big noise
 
Chipp's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: Miami
Posts: 16,852
Blog Entries: 29

FAQs Submitted: 18
Folding Team Rank: 680
Hardware Reviews: 3
Trader Rating: 12
Default

The easiest would be to use HTML frames. Have one centeral frame in the center of the page (index.html) where your actual content goes, then have the links in the Java navigation bar point to that specific frame. (So that news.html or whatever your content is shows up in the centeral frame, while the rest of the page, I/E the nav bar, stays the same.) I'm not as good with HTML as I used to be, but I could probably dig up one of my old sites if you wanted to see some of the code.

EDIT: Hre is a very complicated, but good guide on how to properly set up frames. http://www.w3.org/TR/html4/present/frames.html (I suggest using Frontpage, it makes them a breeze, if not totaly proper.)
__________________
There are two muffins in an oven. One muffin says, "Wow! Its getting hot in here!" The other muffin yells, "Ahhh! A talking muffin!!"

Like cars? Check out http://www.carforum.net! || Like dogs? Check out http://www.dogforum.org!

I get a lot of private messages - I will get back to you, I promise!

System: Precision M4400
CPU
2.4ghz P8600
Motherboard
Dell
Memory
2x2gb DDR2 800
Graphics Card
Quadro FX770M
Hard Drive
160gb 7200 RPM
Sound Card
E-Mu 0404 USB
OS
Windows 7
Monitor
Dell P2210H 22" 1080p LCD

Last edited by Chipp : 09-13-06 at 08:13 PM
Chipp is offline I fold for Overclock.net Overclocked Account Chipp's Gallery   Reply With Quote
Old 09-13-06   #3 (permalink)
Intel Overclocker
 
StepsAscend's Avatar
 
intel ati

Join Date: Jul 2005
Posts: 1,208

Rep: 33 StepsAscend is acknowledged by some
Unique Rep: 33
Folding Team Rank: 1789
Trader Rating: 0
Default

I thought about that. My prof has specifically asked us not to use frmaes though. If I can implement it smoothly then he won't mind but I'll avoid it if possible. Any other ideas?
__________________
System: Wolfdale
CPU
E5200 @ 3.6 GHz
Motherboard
ASRock P43TWINS1600
Memory
4GB Super Talent
Graphics Card
Radeon HD4670
Hard Drive
1TB Caviar Black, Caviar 250GB
Sound Card
X-Fi Extrememusic
Power Supply
Antec Smartpower 500
Case
Antec Solo
CPU cooling
Stock
GPU cooling
Stock
OS
Windows 7 x64, Vista 32
Monitor
Viewsonic 20" WS
StepsAscend is offline I fold for Overclock.net   Reply With Quote
Old 09-13-06   #4 (permalink)
makin' the big noise
 
Chipp's Avatar
 
intel nvidia

Join Date: Dec 2004
Location: Miami
Posts: 16,852
Blog Entries: 29

FAQs Submitted: 18
Folding Team Rank: 680
Hardware Reviews: 3
Trader Rating: 12
Default

Quote:
Originally Posted by StepsAscend
I thought about that. My prof has specifically asked us not to use frmaes though. If I can implement it smoothly then he won't mind but I'll avoid it if possible. Any other ideas?
No frames, eh? Sorry man, that's all I've really ever used. Wish I could help more... Good luck!
__________________
There are two muffins in an oven. One muffin says, "Wow! Its getting hot in here!" The other muffin yells, "Ahhh! A talking muffin!!"

Like cars? Check out http://www.carforum.net! || Like dogs? Check out http://www.dogforum.org!

I get a lot of private messages - I will get back to you, I promise!

System: Precision M4400
CPU
2.4ghz P8600
Motherboard
Dell
Memory
2x2gb DDR2 800
Graphics Card
Quadro FX770M
Hard Drive
160gb 7200 RPM
Sound Card
E-Mu 0404 USB
OS
Windows 7
Monitor
Dell P2210H 22" 1080p LCD
Chipp is offline I fold for Overclock.net Overclocked Account Chipp's Gallery   Reply With Quote
Old 09-13-06   #5 (permalink)
Programmer
 
stupid's Avatar
 
amd nvidia

Join Date: Jan 2006
Location: Tampa, FL, USA
Posts: 1,233

Rep: 148 stupid is acknowledged by manystupid is acknowledged by many
Unique Rep: 117
FAQs Submitted: 1
Trader Rating: 4
Default

chances are your school computers run .net 2.0 framework, and with that you can use what is called asp.net masterpages. You should be able to find some good documentation on the web for them. I use them at work. Basically a masterpage is a webpage that is the 'master' template which has an <asp:contentplaceholder> for where your other pages go, your other pages all load up inside the masterpage, so you only have to edit once. It is very simple to do in ColdFusion as well, but that is most likely not used in class.

I am sure there is a way to do this in php, but it has been so long since I have touched it I don't know off the top of my head.

Here is a simple example (sorry if they are a bit long):

MasterPage.master:
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .sidebar {
        position:absolute;
        background-color:yellow;
        }        
        .content {
        margin-left:100px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="sidebar">
        <a href="Default.aspx">LINK1</a><br />
        <a href="Default2.aspx">LINK2</a><br />
    </div>
    <div class="content">
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
    </div>
    </form>
</body>
</html>
see how it uses the placeholder tag? Thats where it will insert all of your pages as long as the page includes the tag 'MasterPageFile="~/MasterPage.master"' in them

here is Default.aspx:
Code:
<%@ Page Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    Default Page <br /><br />BLA!<br />BLA!<br />BLA!<br />BLA!<br />BLA!<br />BLA!<br />
</asp:Content>
and the other page, Default2.aspx:
Code:
<%@ Page Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    Page 2!?@#?!@#?!    <br />;aklsdhjfkljasghdfkjahsdgf
    <br />;aklsdhjfkljasghdfkjahsdgf    <br />;aklsdhjfkljasghdfkjahsdgf
    <br />;aklsdhjfkljasghdfkjahsdgf    <br />;aklsdhjfkljasghdfkjahsdgf
    <br />;aklsdhjfkljasghdfkjahsdgf    <br />;aklsdhjfkljasghdfkjahsdgf
</asp:Content>
You can see it work here:http://auctionconstructor.com/asp

It is extremely ugly, but you get the point.

fyi, this is an example in asp.net 2.0
__________________
"If there is a god, I hope he has a good excuse"
:turd: Woody Allen

System: Minazo
CPU
Opteron 1210
Motherboard
Biostar TForce 550 SE
Memory
2x2GB G.Skill DDR2 800
Graphics Card
eVGA 8800GT
Hard Drive
500GB 16MB Buf Samsung
Power Supply
Corsair HX520W Modular
Case
CoolerMaster Centurion 5
CPU cooling
CoolerMaster GeminII & Scythe SFF21Ds
GPU cooling
Accelero S1 & Scythe SFF21D
OS
XP Pro SP2
Monitor
Dual monitors: 22" & 19" Widescreens

Last edited by BFRD : 09-14-06 at 07:22 AM
stupid is offline   Reply With Quote
Old 09-14-06   #6 (permalink)
Intel Overclocker
 
StepsAscend's Avatar
 
intel ati

Join Date: Jul 2005
Posts: 1,208

Rep: 33 StepsAscend is acknowledged by some
Unique Rep: 33
Folding Team Rank: 1789
Trader Rating: 0
Default

well, i achieved the desired effect with an iframe. problem is I can't link directly to the page and already have the iframe opened to a specific link. Working on that now.
__________________
System: Wolfdale
CPU
E5200 @ 3.6 GHz
Motherboard
ASRock P43TWINS1600
Memory
4GB Super Talent
Graphics Card
Radeon HD4670
Hard Drive
1TB Caviar Black, Caviar 250GB
Sound Card
X-Fi Extrememusic
Power Supply
Antec Smartpower 500
Case
Antec Solo
CPU cooling
Stock
GPU cooling
Stock
OS
Windows 7 x64, Vista 32
Monitor
Viewsonic 20" WS
StepsAscend is offline I fold for Overclock.net   Reply With Quote
Old 09-14-06   #7 (permalink)
Programmer
 
stupid's Avatar
 
amd nvidia

Join Date: Jan 2006
Location: Tampa, FL, USA
Posts: 1,233

Rep: 148 stupid is acknowledged by manystupid is acknowledged by many
Unique Rep: 117
FAQs Submitted: 1
Trader Rating: 4
Default

You will only link to the main page that has the iframe within it. The other pages will be rendered in the iframe only, the url will never change.

Main page (with navigation):
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
    <title>TEST</title>
    <style type="text/css"> 
        body {background-color:gray;}
        .sidebar { position:absolute; top:0; left:0;} 
        .content { margin-left:100px; width } 
    </style>
</head> 
<body>
    <div class="sidebar"><br /><br />
        <a href="#" onclick="document.getElementById('iframe').src='iframe2.htm';">PAGE1</a><br /> 
        <a href="#" onclick="document.getElementById('iframe').src='iframe.htm';">PAGE2</a><br /> 
    </div>
    <div class="content">
        <iframe id="iframe" scrolling="no" style="border:0" frameborder="0" src="iframe.htm" width="100%" height="100%"></iframe>
    </div>
</body>
</html>
the two pages it will load:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body style="background-color:Blue;">
</body>
</html>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
</head>
<body style="background-color:Lime;">
</body>
</html>
I am not sure if I answered your or not, please let me know.
__________________
"If there is a god, I hope he has a good excuse"
:turd: Woody Allen

System: Minazo
CPU
Opteron 1210
Motherboard
Biostar TForce 550 SE
Memory
2x2GB G.Skill DDR2 800
Graphics Card
eVGA 8800GT
Hard Drive
500GB 16MB Buf Samsung
Power Supply
Corsair HX520W Modular
Case
CoolerMaster Centurion 5
CPU cooling
CoolerMaster GeminII & Scythe SFF21Ds
GPU cooling
Accelero S1 & Scythe SFF21D
OS
XP Pro SP2
Monitor
Dual monitors: 22" & 19" Widescreens
stupid is offline   Reply With Quote
Old 09-24-06   #8 (permalink)
Programmer
 
sniperscope's Avatar
 
amd nvidia

Join Date: Apr 2006
Location: Kent (England)
Posts: 1,245

Rep: 90 sniperscope is acknowledged by some
Unique Rep: 77
FAQs Submitted: 3
Folding Team Rank: 4333
Trader Rating: 0
Default

All you need to do is place the javascript in a separate file (e.g. navbar.html) and just include it on every page using PHP:

Code:
<?php include "www.yoursite.com/navbar.html");
?>

System: Bob
CPU
AMD Athlon 64 3800+
Motherboard
ASUS A8N- SLI Premium
Memory
2GB (2X1GB) Corsair XMS Pro LED TwinX DDR400
Graphics Card
XFX GeForce 7800GT Extreme Edition
Hard Drive
2x200GB Barracuda SATA RAID0 + 250Gb ATA
Sound Card
AC'97
Power Supply
Antec TruePower 550W
Case
Thermaltake Armour
CPU cooling
Stock
GPU cooling
Stock
OS
Windows Vista Home Premium x64
Monitor
Hanns G 19" widescreen HW191D
sniperscope is offline I fold for Overclock.net sniperscope's Gallery   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 07:55 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.15171 seconds with 8 queries