Web Development

  Homes arrow Web Development arrow Page 2 - HTACCESS Wrappers with PHP
 Webmaster Tools
 
Base64 Encoding 
Browser Settings 
CSS Coder 
CSS Navigation Menu 
Datetime Converter 
DHTML Tooltip 
Dig Utility 
DNS Utility 
Dropdown Menu 
Fetch Content 
Fetch Header 
Floating Layer 
htaccess Generator 
HTML to PHP 
HTML Encoder 
HTML Entities 
IP Convert 
Meta Tags 
Password Encryption
 
Password Strength
 
Pattern Extractor 
Ping Utility 
Pop-Up Window 
Regex Extractor 
Regex Match 
Scrollbar Color 
Source Viewer 
Syntax Highlighting 
URL Encoding 
Web Safe Colors 
Forums Sitemap 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB DEVELOPMENT

HTACCESS Wrappers with PHP
By: Jase Dow
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2004-12-12

    Table of Contents:
  • HTACCESS Wrappers with PHP
  • That's all you've...
  • That contains the...
  • The same basic...
  • If our wrapper...
  • Without HTTP compression...
  • A practical way...
  • I've included several...
  • You could also...

  • 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
     
     

    SEARCH DEV MECHANIC

    TOOLS YOU CAN USE

    advertisement

    HTACCESS Wrappers with PHP - That's all you've...


    (Page 2 of 9 )

    That's all you've got to do for the htaccess file. Save that as "htaccess.txt" -- we'll get back to it later.

    For the actual wrapper, create a new text file with the standard tags, then assign your header and footer file names to variables called $header and $footer.

    $header = "header.html";
    $footer = "footer.html";

    Redirecting a user to our script doesn't pass its contents to it, just the filename. If you call phpinfo() in your script and scroll to the bottom you can see all the server variables which give us the name. The element "REQUEST_URI" in $_SERVER gives us the relative path (/header/sample.html), but we want the full system path since we're going to be reading the actual file (/home/username/wwwroot/your.host/header/sample.html), which is "PATH_TRANSLATED".

    $file = $_SERVER["PATH_TRANSLATED"];

    The name of the file that just tried to be shown is now stored in the variable $file. Three simple things are left: output the header, output the actual file, then output the footer.

    readfile($header);
    readfile($file);
    readfile($footer);

    That's it. Here's the entire header.php file:

    All that, in just nine lines of code. Download it here: http://www.jumpx.com/tutorials/wrapper/header.zip

    More Web Development Articles
    More By 359

       

    WEB DEVELOPMENT ARTICLES

    - On Page SEO for New Domains
    - Improve Your Site`s Speed
    - Safari Books Online Review
    - Creating an Estore From the Ground Up
    - Most Common SEO Mistakes Developers Make
    - Making the Most of Your Titles and Meta Desc...
    - Five Ways Using Flash Can Damage Your Site
    - A Web Designer`s Guide to Colors
    - Use Webstarts to Create a Free Site
    - More Than Just Looks. How Your Web Design C...
    - How to Design Content Pages
    - Mint Review
    - Make Your WordPress Website Look Professional
    - How to Create a Mobile Web Site
    - Meta Tags: Still Useful?

    Developer Shed Affiliates

     



    © 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap