This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I change website content without touching every page?
01-16-2013, 09:25 AM
Post: #1
How do I change website content without touching every page?
I have a header content I use on every page. This includes a banner, navigation and links to facebook, twitter and myspace. The script also includes the page styles. Is there a way to put all this into a single web document and put a code in place so it automatically inserts it into the page? I want to be able to freely make changes to some of that without editing every single page.

Ads

Find all posts by this user
Quote this message in a reply
01-16-2013, 09:35 AM
Post: #2
 
Best way to do this it to use a programming language such as PHP.

http://www.php.net

I use this on my websites. It allows you to mix code and HTML.
Every page has to have a php extension and your web server has to support PHP scripting (most do).

You would have your header file saved and then use the
<?php include('filename.inc'); ?>
line to get your standard header and footer into any page.

Wil .

Ads

Find all posts by this user
Quote this message in a reply
01-16-2013, 09:44 AM
Post: #3
 
Try the PHP function include().

Your site should look like this:

File index.php
<html>

<body>

<div id="header"></div>
<div id="navigation"></div>
<div id="content">

<?php
$site = $_GET["site"];
include('homepage/'.$site.'.php');
?>

</div>
</body>

And your links should look like this:
<div id="navigation">

<a href="homepage/index.php?site=home"></a>
<a href="homepage/index.php?site=about"></a>
</div>


Now create the files:
homepage/home.php with your content in it.

The link will now tell the file index.php which site to load, and index.php will simply insert the content of the included file.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)