Search code examples
cssserver-side-includes

A way to edit content by altering one file?


I have a contact css tab on my left side on my website, I have more then 30 pages and I don't wantto manually alter all those pages later when data had changed. Does anyone knows a sollution so I only have to alter 1 file to have all pages edited?

Perhaps in javascript?

The code below is for the tab

<div class="slide-out-div">
        <a class="handle" href="http://link-for-non-js-users">Content</a>
      <h3>Onze contact gegevens</h3>
        <p>Adres: van Ostadestraat 55<br />
          Postcode: 8932 JZ<br />
        Plaats: Leeuwarden<br />
        Tel: 058 844 66 28<br />
        Mob: 0629594595
        <br />
        E-mail: <a href="mailto:info@friesecomputerservice.nl">info@friesecomputerservice.nl</a><br /><br />
        </p>
<p>Mocht u vragen hebben dan kunt u gerust bij ons terecht voor meer informatie.</p>

Edit:

This is in my html

<!--#include virtual="contact.txt" -->
  </body>

and this is in my contact.txt which is located in the rot of my webfolder:

<div class="slide-out-div">
        <a class="handle" href="http://link-for-non-js-users">Content</a>
      <h3>Onze contact gegevens</h3>
        <p>Adres: van Ostadestraat 55<br />
          Postcode: 8932 JZ<br />
        Plaats: Leeuwarden<br />
        Tel: 058 844 66 28<br />
        Mob: 0629594595
        <br />
        E-mail: <a href="mailto:info@friesecomputerservice.nl">info@friesecomputerservice.nl</a><br /><br />
        </p>
<p>Mocht u vragen hebben dan kunt u gerust bij ons terecht voor meer informatie.</p>

Solution

  • You may want to use Server Side Includes (SSI).

    You would place your code snippet into a separate file, such as contact.txt, and then you would simply reference it in all your 30 pages by using:

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

    SSI is supported by all the popular web servers, including Apache, IIS and lighttpd.