We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

HTML file manipluation program

Does anyone know of a program which can suck in a 'master' HTML document, take the content, say the header, from between two predetermined tags, and then put that code between the same two tags in a specified set of 'slave' HTML documents?

Anyone followed my drift, and if so, can anyone reccomend a good, free program that can do it? Or is this going to be somthing that I'll have to knock together for myself?

Thanks.
Ubuntu is an ancient African word, meaning: 'I can't configure Debian'.

Comments

  • Dreamweaver has 'templates'.. sounds like what you need

    Personally, i'd do it in a language like PHP to make it free
  • timbim wrote: »
    Does anyone know of a program which can suck in a 'master' HTML document, take the content, say the header, from between two predetermined tags, and then put that code between the same two tags in a specified set of 'slave' HTML documents?

    Anyone followed my drift, and if so, can anyone reccomend a good, free program that can do it? Or is this going to be somthing that I'll have to knock together for myself?

    Thanks.


    Hmmm im not 100% sure i understand but are you talking about PHP includes?

    You can have a website and say for example you wanted to change the menu. Instead of going to the page with the content on to edit the menu you can edit a menu 'file' which will then update every page with the menu on.
  • If you mean you want to duplicate code onto more than one webpage then you need to use PHP includes or Server Side Includes providing your hosting package supports it

    e.g. you have a header file, we call it header.php, with all of your header information in.

    Whenever you want to include the file in another file simply enter <? include 'header.php'; ?>
  • timbim_2
    timbim_2 Posts: 1,292
    1,000 Posts Combo Breaker
    Forumite
    I think PHP includes may be the way forward, but does that require that I write the whole page in PHP, or can you include a PHP object in HTML pages? I'm guessing not, but worth a try...
    Ubuntu is an ancient African word, meaning: 'I can't configure Debian'.
  • You can save a page with a .php extension instead of a .html extension (you would need to do all pages in the site like this). The rest of the code stays exactly the same apart from the include part

    For example, (my current work)
    <? include 'includes/header.php' ?>
                <img src="images/news.png" alt="Latest News" />
                <h1>01.09.08 - Lorem Ipsum Doler Site Amet</h1>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                
                <h1>02.08.08 - Blah Blah Blah</h1>
            </div>
        </div>
    </body>
    </html>
    

    The header has the main Doc Type, page title, header images and opening of the main div tags.
This discussion has been closed.
★ ★ ★ Meet your Ambassadors

Categories

  • All Categories
  • 356K Banking & Borrowing
  • 255K Reduce Debt & Boost Income
  • 456.3K Spending & Discounts
  • 248.5K Work, Benefits & Business
  • 606.3K Mortgages, Homes & Bills
  • 179.1K Life & Family
  • 264.1K Travel & Transport
  • 1.6M Hobbies & Leisure
  • 16.2K Discuss & Feedback
  • 37.7K Read-Only Boards
Quick Search

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.