FAQ.


So what is Mod Layout?

Where do I get it from?

What sort of license does it have?

How can I make suggestions for it?

How can I report a bug?

Is there a mailing list?

Is there anyplace I can see it at work?

How do I install it?

What are the directives?

I have my own type that I have defined with AddHanlder, how can I wrap that?

What happened to the CGIEnable directive?

Hey, I don't want to wrap CGI's, just HTML, how do I do that?

So what is the difference between LayoutFooter, LayoutFooterFile, and LayoutLayoutTXT (or LayoutHeader, LayoutHeaderFile, and LayoutHeaderTXT) (depreciated)?

What handlers does LayoutDefaultHandlers do?

What environmental variables does ModLayout add?

How do I pick different headers and footers for different pages dynamically?

Hey, what about frames?

Hey, what about using this with the proxy server?

Can I have just the footer and header print?

Is it possible to specify text/* in for a LayoutHandler?

What about directories?

Can I have it ignore certain files?

But can I have only certain files not display headers (or footer)?

How do I modify outbound HTTP headers?

How do I make this work with PHP?

So what is up with custom error documents?

I am getting 405's with SSI documents?

What is the future?

So what is Mod Layout?

Mod layout wraps a page, by saying this I mean that it can place information at both the beginning and the end of a document. This allows you do create a single look and feel throughout a website without using server side includes to "automagically" add content in either of these two locations. You can use it to add standard disclaimers to all of the pages on a server or to place banner adds on the top of all pages (I know, banner adds, ick...). I've even seen people use the header and footer to place the entire contents of a given server inside of tables. There are many possibilities.


Where do I get it from?

You can get it from either here via the web or here via ftp.

What sort of license does it have?

You are pretty much free to use it as you please. Check out the License file with the distribution for more details. In all likelihood I will switch to either GNU or Apache style licensing at some point in the future.


How can I make suggestions for it?

Send email to brian@tangent.org.


How can I report a bug?

Fill out the form here.


Is there a mailing list?

Yes!. Two mailing lists have been created. One is announce-mod_layout@tangent.org which is only used for sending out announcements about new versions of the software. The other is mod_layout@tangent.org which is for general discussion of the sotware and its uses. Send mail to minordomo@tangent.org with a subject of "subscribe announce-mod_layout" or "subscribe mod_layout" to subscribe to either of the mailing list.


Is there anyplace I can see it at work?

A very distant ancestor can be seen at The Virtual Hospital. I know of a few other large sites, but I do not have their permission to list them here. Send me a URL if you have a site using it and I will probably add it to the page.


How do I install it?

From the INSTALL file:


Do you use DSO? If so just type make and

as long as apxs is in your path all things

should go smoothly.

If you are not using DSO you should be :)


If for some reason you need to compile

apache try the following:

1. Change the current directory to the directory containing your apache

source distribution.


2. Call the configure script as you normally would and add the switch:

--add-module=<path-to-mod_layout-directory>/mod_layout.c


3. Make sure the build environment is clean by issuing the following

command:

> make clean


4. Build the new httpd binary with:

> make


5. Install the new httpd binary with:

> make install


What are the directives?

  • LayoutHeader
  • LayoutFooter
  • LayoutHandler
  • LayoutProxy
  • LayoutComment
  • LayoutDefaultHandlers
  • LayoutHandlerGlob
  • LayoutDisplayOriginal
  • LayoutIgnoreURI
  • LayoutIgnoreHeaderURI
  • LayoutIgnoreFooterURI
  • LayoutHTTPHeaderOff
  • LayoutOff
  • HeaderOff
  • LayoutHTTPOverride
  • LayoutHTTPHeader
  • LayoutHeaderTXT (deprecated in version 2.5)
  • LayoutFooterTXT (deprecated in version 2.5)
  • LayoutHeaderFile (deprecated in version 2.5)
  • LayoutFooterFile (deprecated in version 2.5)
  • LayoutTimeFormat
  • LayoutPostAsync
  • LayoutMergeErrorIgnore
  • LayoutMerge
  • LayoutMergeBeginTag
  • LayoutMergeEndTag
  • LayoutCache

  • I have my own type that I have defined with AddHanlder, how can I wrap that?

    Use LayoutHandler. AKA

    LayoutHanlder foobar/type


    What happened to the CGIEnable directive?

    It was removed after version 0.5. Why? I went a different direction in the code. I decided to give people the option of using LayoutHandler to add new types instead of predefining them.


    Hey, I don't want to wrap CGI's, just HTML, how do I do that?

    Use the following directives:

    LayoutDefaultHandlers Off

    LayoutHandler text/html.


    So what is the difference between Layout, LayoutFile, and LayoutTXT (or Header, HeaderFile, and HeaderTXT)?

    These methods were depreciated in version 2.5

    Performance. If you have some some non-dynamic content then you would be better off using the *TXT directives (If the content is more then a single line you should consider putting it in a seperate file and using LayoutFile and HeaderFile). This way the content will be loaded directly into Apache (unlike the Layout and Header methods, which make call to Apache to process).


    What handlers does LayoutDefaultHandlers do?

  • server-parsed
  • text/html
  • text/plain
  • perl-script
  • cgi-script
  • application/x-http-cgi

  • I will probably add more in the future. Email me if you have one that you would like to see added in by default.


    What environmental variables does ModLayout add?

    Three environmental variables are currently added to environmental namespace for Layout and Header files. They are:

  • LAYOUT_SCRIPT_NAME
  • LAYOUT_PATH_INFO
  • LAYOUT_QUERY_STRING
  • LAYOUT_LAST_MODIFIED They represent the parsed information that made up the original request. You can set the look of LAYOUT_LAST_MODIFIED by using the LayoutTimeFormat directive).

    How do I pick different headers and footers for different pages dynamically?

    Write a cgi/servlet/PHP script and use the LAYOUT_SCRIPT_NAME environmental variable to determine what content you wish to display.

    Hey, what about frames?

    I personally hate them.

    You want to know more? Ok, what has been discovered thus far is that using any of the Header tags will break framesets. Layouts seem to work fine though. If any anyone has had any better luck mail me.



    Hey, what about using this with a proxy server?

    As of version 0.9 I began to test support for the proxy module. Currently I have only tested ProxyPass and it seems to work (any feedback would be appreciated). In cases where a flash file is used as an Index (or any filetype which is not wrappable) the page that is return will be broken. Also, anything that ProxyPass can not support, mod_layout will not support.



    Can I have just the footer and header print?

    Yes. The most common reason to do this is if you are handling frames (and if you are doing frames don't forget to make the header dynamic and smart enough not to wrap itself). This can be done by turning off the wrapped page using "LayoutDisplayOriginal Off".


    Is it possible to specify text/* in for a LayoutHandler?

    Yes, as of version 1.2 you can turn this feature on using "LayoutHandlerGlob On". Keep in mind though that depending on the number of types you are wrapping this can slow things down. More effort is needed to determine how much of a performance hit this really is. BTW If you specify something like "*/*", yes you will wrap everything, but this includes images (which will show up corrupted).


    What about directories?

    Ok, so you tried adding:
    LayoutHandler text/directory
    and it didn't work right?
    At least for Solaris and Linux (that is the only place I have tested this on), the following should work:
    LayoutHandler httpd/unix-directory

    Can I have it ignore certain files?

    Yes!. You can speficy URI that are to be ignored by using the LayoutIgnoreURI directive. It handles regular expressions.


    But can I have only certain files not display headers (or footer)

    Yes!. You can speficy URI that are to be ignored for headers by using the LayoutIgnoreHeaderURI directive. A similair directive, LayoutIgnoreFooterURI exists for footers. Both handle regular expressions.


    How do I modify outbound HTTP headers?

    If you turn on LayoutHTTPOverride then your Header (if you have one) will be required to produce the correct HTTP Headers. If you lack a Header it will default to the middle document that was called. In addition you can create a CGI/servlet/PHP script and call it with LayoutHTTPHeader. It is independent of the Header and you can use it it to put HTTP Headers into your outbound connections.


    How do I make this work with PHP?

    The following is an example which will wrap PHP along with html documents (this would catch everything from both version 3 and 4).

  • LayoutHandler application/x-httpd-php
  • LayoutHandler application/x-httpd-php3
  • LayoutHandler application/x-httpd-php3-source


    So what is up with custom error documents?

    Anything below version 2.5 gives you unpredictable results. As of 2.5 they work fairly well as long as you specify a URI for them, or plain text (even though plain text does show off an annoying Apache bug). If you want to make sure that the URI is always wrapped you will want to make sure that the handler type for the ErrorDocument is handled by mod_layout (otherwise you are going to end up with some errors wrapped, and others not).
    Using redirects for the ErrorDocuments will not work unless you are using version 2.8 with merge enabled.


    I am getting 405's with SSI documents?

    The answer is that you have LayoutPostAsync enabled. Right now there is no fix for this. The SSI module rejects attempts on SSI's when it thinks the request was a POST.


    What is the future?

    This is really just the first component of what will be an entire web publishing system. I have a few others that I have written over the years that I am currently trying to clean up enough to give away. We shall see how ambitious I get :)