• Advertisement
Sign in to follow this  

Equivalent to #include in HTML?

This topic is 3406 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement