• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

question : Php and HTML

cirrrocco

Golden Member
Hey I really suck at programming and I have run into an issue where maybe you guys know what to do.

Issue on hand:
1. I have a page split into header, containing links
2. left navigation area , containing again a bunch of internal links
3. central text area
4. bottom again similar to header

so question I have is if I want to add a facebook like link or even any other link to the header or left navigation section.. I have to do a find replace on abt 13000 files.

Is it possible that I have a html file, where I can pull in header from another file, left navigation from other file, leave central content area as is, and again bottom header from same source as header

Is this possible in html, so now instead of me modifying all 13000 filles, I just replace the header html file and it is automatically updated when any of the 13000 pages are opened.

Basically now I want to add a facebook link to the header level and I think it is a pain in the ass to update all the pages and then upload all the pages. so what can i do. Is there something I can do in html or do I need php for this.
 
wow 13'000 files? With an appropriate text editor I think that i would not be that difficult to achieve. 😛

Fun aside of course you can do that. I just started to learn php and I think that this "feature" is rather important and very helpful.

http://php.net/manual/de/function.include.php

What I have:

1 header.inc.php
1 menu.inc.php
1 footer.inc.php

the header includes the menu file.

Also header and footer define my page layout (2 Column, css). Note that header and footer alone are not "valid" html because header does not close all html tags, the footer does.

Now if you need to change links, you can do it once in 1 file. Also if you need to move your images, javascript or css files to a different folder, again you only need to change the header.

A page then looks like this:

Code:
<?php require 'header.inc.php'; ?>

        //Page Content 
        //html and php

<?php include 'footer.inc.php'; ?>


simplified header:

Code:
<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/main.css" type="text/css" rel="stylesheet" media="all" />
        <script type="text/javascript" src="js/jquery-1.5.js"></script>
        <title>Application Name</title>
    </head>
    <body>
        <div id="wrapper">
            <div id="head">
                <h2>Application Name</h2>
                <hr>
            </div>
            <div id="columns">

                <?php include 'menu.inc.php'; ?>

                <div id="content">

simplified footer:

Code:
            </div>
        </div>
        <div id="foot">
            <hr>
            <small>Copyright Notice</small>
        </div>
    </div>
</body>

</html>
 
Perfect man. Thanks a lot. so it is possible pretty quick in php. One quick question thgh.

so the html page, should it still be a html extension or should it change to php extension

with regard to your first question, editing is not the issue, but uploading them is a pain in the ass..hahaha
 
Yea php includes (or requires) would accomplish this easy. However for a site that big, I'd be looking to migrate it to a CMS.
 
Back
Top