PHP
  Home arrow PHP arrow Page 4 - The Modular Web Page
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

The Modular Web Page
By: Peter Lavin
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 88
    2003-09-30

    Table of Contents:
  • The Modular Web Page
  • Designing Your Page Layout
  • The Code
  • The Code, Cont'd
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Modular Web Page - The Code, Cont'd


    (Page 4 of 5 )

    top.inc

    The code here is pretty simple. We want our first column to span the width of the browser and since our table has only a maximum of two columns the “colspan” attribute is set to “2”. The “class” attribute is not strictly necessary but by including it the presentation of our page can be made more flexible. We can quickly reference this particular “td” tag from our style sheet. Setting or changing the style attributes from one central location makes designing and maintenance much easier.

    <!--one column spanning the browser window -->
    <td class="top" align="center" colspan ="2" height="80px">
    <p style="font-size:26pt;">
    <i><b>Site Name</b></i>
    </p>
    </td>

    For the sake of showing something we’ve put some text in this column but it might more typically be a graphic. Notice also that this “top.php” file is made up of one complete column – a set of open and close table data tags - inserted between the open and close tags for a table row. Document your code with internal comments. Web pages can grow into large and unwieldy things. You may think you understand your page thoroughly as you are creating it but try coming back to it after a few days off. You’ll wish you had even more comments.

    sidebar.inc

    <!--a column containing links -->
    <td class="sidebar" valign="top" width="20%">
    <p class="head">Links</p>
    <a href="page1.html">Link One</a><br />
    <a href="page2.html">Link Two</a><br />
    <br />
    <br />
    </td>

    Very similar to our “top.php” file. We want our sidebar to occupy twenty percent of the page so have set the width to this value. The advantages of using include files are most evident here. To change the links in any page that includes this file we change it in one and only one place.

    bottom.inc

    <td class="sidebar"> <a href="#top">Return to Top</a>
    </td>
    <td class=”main ”align="center"  colspan = "2">
    Copyright
    </td>

    By now I’m sure you’ve pretty much got the idea but a few comments on this include file are in order. This final file differs in that it contains two columns. We want the first column to contain a hyperlink to the top of the page and we want this hyperlink to always appear at the very bottom of the page. Creating a column in the final row allows us to do this. This column will “inherit” the width of the sidebar column above so its width will be identical to the sidebar. We want it to appear seamlessly as part of the sidebar so this is a desirable effect. We also want it to have the same display characteristics as the sidebar so we have given it the same class name. Because of this, changes to the sidebar class in the CSS file will effect the entire left side of our page. For the moment, the border of this cell is visible but remember we will be removing it when the page is complete.

    Similar arguments apply to our last column. Hence its class name.

    More PHP Articles
    More By Peter Lavin


       · This is a terrific article. It has been my experience that modular programming has...
       · I just wanted to point out that it has been suggested that in php using a include...
       · I just wonder if possible to call template.php and pass to it page with center...
       · The article is allright. For one, it encourages the user to use unsecure practices,...
     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT