how to insert header/footer server side for existing html files

Discussion in 'Programming' started by jjdubb, Mar 23, 2004.

  1. compar

    compar Peon

    Messages:
    2,705
    Likes Received:
    169
    Best Answers:
    0
    Trophy Points:
    0
    #21
    I'm not an expert on all of this, but it seems to me that it could be done more simply with ".ssi" files.

    Simply write a header.ssi and a footer.ssi file. Then, assuming that the pages have a header and footer now, use some good text editor with a search and replace function and replace each header and footer with the appropriate ".ssi" file?
     
    compar, Apr 3, 2004 IP
  2. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #22
    thats an idea, use SSI includes, althought PHP has a better performance and many servers have SSI disabbled.
     
    nlopes, Apr 3, 2004 IP
  3. Pulp

    Pulp Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Hi, when I use this rewrite mod thing, I get only header and footer, no file is displayed. Any suggestions?
     
    Pulp, Jun 26, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #24
    Do you have a header and footer file setup, and do you have PHP running?
     
    digitalpoint, Jun 26, 2004 IP
  5. Pulp

    Pulp Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    Yes, I have php and apache with rewrite mod. I did it exactly as you wrote it but everthing I got was header/footer.
     
    Pulp, Jun 26, 2004 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #26
    No idea to be honest... Someone had the better idea (somewhere in this thread) of doing it at the Apache level, rather than with PHP. Which actually is a better idea..
     
    digitalpoint, Jun 26, 2004 IP
  7. Ron Williams

    Ron Williams Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    I am using digital point's method. It works great, but it applys the header and footer to all file types, including MP3's. Considering I have people hosting there files on my site, this is a problem. How do I restrict it to only specified file types?
     
    Ron Williams, Jan 4, 2006 IP
  8. n0other

    n0other Peon

    Messages:
    146
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Hello. Take a look at mod_layout. http://tangent.org/index.pl?lastnode_id=478&node_id=362
    
    mod_layout is an Apache module that provides both 
    a Footer and Header directive to automagically include 
    output from other URIs at the beginning and ending of a
     Web page. It can be used to wrap documents for a 
    standard look and feel for a site (or to insert banners
     on any given document in a site). Currently known to 
    support mod_perl, PHP and Apache JServ. Should 
    support just about any type of handler.
    
    Code (markup):
     
    n0other, Jan 4, 2006 IP
  9. Ron Williams

    Ron Williams Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #29
    I looked into the module, but I can not use it because I do not have access to httpd.conf. Any other solutions?
     
    Ron Williams, Jan 4, 2006 IP
  10. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #30
    PHP has better performance only if your pages are already PHP. Otherwise, SSI is just as efficient.
     
    FeelLikeANut, Jan 5, 2006 IP
  11. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #31
    Shawn's solution seems like the best way to go, without manually adding to each file.

    Also you could use a solution such as index.php?module=pagename

    where it would load the pagename.php. Though unless you use a select case that has security risks.

    Pm me if u need more help
     
    tccoder, Jan 28, 2006 IP
  12. DhirajSaini

    DhirajSaini Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #32
    just using the two tags header n footer
     
    DhirajSaini, Jun 28, 2011 IP