MTCgi 1.0

February 28, 2003 - updated February 8, 2006 (Download)

The MTCgi tags give you access to parameters passed to the CGI that is currently building the page. These tags are only useful in templates that are invoked dynamically, for example search templates (invoked by mt-search.cgi), comment listing templates (invoked by mt-comments.cgi) or any template that is used by the mt-view.cgi.

For example, to display all parameters submitted with a search request, you could use the following code in your search template (you would want to use encode_html attribute to properly encode any special characters in the values):

<MTCgiParamName>: <MTCgiParamValue encode_html="1"><br />

The general purpose search template examples shows how MTCgi tags are used to generalize the default search template.

  • MTCgiParams
    This container tag represents all parameters passed on the URL (i.e. everything following the question mark in the URL) or submitted from a form. You can use the MCgiParamName and MTCgiParamValue tags to display the contents of the parameters. This tag can be modified using the following attributes:
    • include="param1,param2,param3"
      Only include the specified parameters. By default all parameters are included. For example, to only process parameters named "IncludeBlogs", "SearchSortBy" and "ResultDisplay", you would use the following code:
      <MTCgiParams include="IncludeBlogs,SearchSortBy,ResultDisplay">
    • exclude="param1,param2,param3"
      Exclude specified parameters. Overrides the include attribute. For example, to exclude the parameter named "submit", you would use the following code:
      <MTCgiParams exclude="submit">
    • limit="n"
      Limit how many parameters are processed. By default all included parameter values are processed.
  • MTCgiParamName
    Returns the name of the current parameter.
  • MTCgiParamValue
    Returns the value of the current parameter. You can use this tag outside of the MTCgiParams tags if you also specify the option name attribute.
    • name="param1"
      The optional name parameter allows this tag to be used outside of the MTCgiParams tags. However, if more than one parameter has the same name "param1", only the first value is returned.