5 replies [Last post]
Mastametz
Offline
newbie
hell
Last seen: 15 years 19 weeks ago
hell
Timezone: GMT-8
Joined: 2004-07-29
Posts: 3
Points: 0

Hi, i'm new to the forum and new to CSS. I have a basic working knowledge of html and C++...and i'm building a new site - www.fallingdragon.com , what i want to do is write a nav section or navbar or something of the sort, and have it inserted into every page of the site, without having to write it out in every page....so i dunno if i can make a Function of sorts like in C++, or ...i dunno what to do.

homchz
Offline
Enthusiast
Last seen: 12 years 48 weeks ago
Joined: 2004-07-23
Posts: 77
Points: 0

uhh...CSS equivalent to C++ functions?

Not sure if you can do it with CSS alone, but does C++ have an include funtion?

I code in PHP and I can

<? include 'Navbar.php' ?>

within a page and it will put the Navbar.php page where ever I placed the code.

ASP has this funtion to I think. Hope this helps

Josh

Mastametz
Offline
newbie
hell
Last seen: 15 years 19 weeks ago
hell
Timezone: GMT-8
Joined: 2004-07-29
Posts: 3
Points: 0

uhh...CSS equivalent to C++ functions?

in C++ i could do something like...write a function in an external file... for example...

void Nav()
{
(nav bar code here)
}

and then in the main file i just would have to write

Nav();

and whatever is in the function will be run, i think there is another name for this...encapsulation..or something. Just an easy way to reuse the same code.

Mastametz
Offline
newbie
hell
Last seen: 15 years 19 weeks ago
hell
Timezone: GMT-8
Joined: 2004-07-29
Posts: 3
Points: 0

uhh...CSS equivalent to C++ functions?

homchz wrote:
Not sure if you can do it with CSS alone, but does C++ have an include function

if i for example made an external file that had all my functions and classes in it...like 'Stuff.h'...i would go into the program and write #include "Stuff.h" and all classes and functions would be inherited by the program.

EssentialBuyerGuides
EssentialBuyerGuides's picture
Offline
Enthusiast
England
Last seen: 15 years 24 weeks ago
England
Joined: 2004-06-25
Posts: 91
Points: 0

uhh...CSS equivalent to C++ functions?

If you're well versed in C++ Javascript wouldn't be much a of leap fo you, if you were wanting to make an interactive nav-bar that sorts it's content dynamically.

I still use dreamweaver and it's template system for maintaining congruent content across a site.

It's basically a glorified find/replace that checks and replaces content outside of dreamweaver specific comments like

<!-- TemplateBeginEditable name="Stuff1" -->

This is the stuff that stays the same.

<!-- TemplateEndEditable --> 

So it essentially finds/replaces the structure of the page without interfering with the content.

The opposite to this are Lirbrary items which are unique things like navbars etc that get replaced when dreamweaver spots similar style tags.

Dunno, if you're looking for simplicity, try out Dreamweaver with it's template system for keeping your pages in check, or like homchz suggested, if you have any kind of scripting on your server like ASP / PHP / Perl you could include nav bars/footers/headers etc as the page loads, all from the server, which would only mean changing/uploading one file

Up to you, whatever at the end of the day, works out the easiest route. Smile

bfaust
Offline
newbie
Manassas, VA
Last seen: 15 years 21 weeks ago
Manassas, VA
Joined: 2004-07-12
Posts: 5
Points: 0

uhh...CSS equivalent to C++ functions?

If your server supports SSI (Server Side Includes), you should be able to try one or the other of these examples...

<!--#include file="nav.txt" -->

or

<!--#include virtual="nav.txt" -->

This simply inserts the requested document within the html. You may typically have to figure the preferred language, like .asp, .php, .cfm, etc. Otherwise, your document could just be "nav.html".