Sign in to follow this  
lonewolff

Equivalent to #include in HTML?

Recommended Posts

I have a block of HTML that repeats through my site (a menu using anchors). The problem is that if I add or remove a link, I need to then do it on every page (as the links are standard to every page). I am also using CSS but as far as I know the CSS wont help me in this case. Correct me if I am wrong. I generally code in C++ so effectively I guess I am after an #include equivalent. Is there such a beast in HTML?

Share this post


Link to post
Share on other sites
If your task is just including one file in another and PHP seems a little overkill, there's always SSI (available on hosts I've used in the past, not sure about yours!)

Share this post


Link to post
Share on other sites
I've read about CSS to be able to dynamically add content but I don't know wich kind nor how. You might give it a look though...

Share this post


Link to post
Share on other sites
I recommend using SSI if you don't feel like changing all of your pages' extension to php. Just be sure you understand the difference between "file" and "virtual". Many colleagues of mine at work struggle with using includes because "file" and "virtual" includes.

As for the CSS content property -- I would recommend against using it for something like this. It wouldn't be good separation of content from presentation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this