phpDocumentor templates
[ class tree: templates ] [ index: templates ] [ all elements ]
Prev Next

Templates Tutorials

Intra-page navigation (TOC)

File Types by Name

Templates are folders with files that build your web page based on whatever parameters matter for each page being generated. Files include $disp.main.php or "mains", foo.inc.php or "incs", foo.disp.php or "disps", style.css, print.css, and images. This tutorial focuses entirely on the .php files. Sorry but you're on your own with the style sheet stuff.

To customize a template you'll have to get used to what these tutorials will refer to as "chasing $params". Most of the functions that you will use in your template ("T-tags") allow you to modify their behavior by providing values for parameters. Finding the name of any given parameter and it's default value is what chasing $params is all about

$disp.main.php ("mains")

mains, or $disp.main.php files are the "big picture" creators. One of the first thing Quam Plures does is pick the main file to use based on the value of $disp. Possible filenames are:

  • 'index': this is the only required file and is used when one of the others is not.
    • (index is not a possible value of $disp but you always need to have an index.main.php file in your template)
  • 'page': this is used when the displayed page will display only one post/item that is a "type=page" post/item.
  • 'posts': this is used when the displayed page will display more than one post/item.
  • 'single': this is used when the displayed page will display only one post/item.
  • 'feedback-popup': this is used when feedback goes in a popup window, which you might do if you think you can tell my browser what to do, which you can't, so you shouldn't even try, so maybe we shouldn't even have this.

mains generally use template_include() and template_container(), can also use template tags(), and usually have some good old fashioned html, so have fun with it but don't let it get you frustrated or pissed off. It ain't easy at first but it works so don't worry. Be Happy!

When mains play nice they close the html tags they open. You should write mains that play nice :)


_foo.inc.php ("incs")

incs, or _something.inc.php files, are generally used to build a section of the requested page. Think in terms of "page footer" or "sidebar" and you're close.

incs build sections of the requested page. These files should not be called directly! Either a $disp.main.php or another *.inc.php uses template_include() to add the specified *.inc.php file to the page-building process.

Generally speaking, you would be better off using template_include() to add a .inc.php file when you want to 'tidy up' your .main.php file (large blocks of specific-purpose code), or simply not repeat the same block of code across multiple $disp.main.php file.

There is no limit to what you can name a .inc.php file, but there are common or canned incs.

  • '_html_header.inc.php':
  • '_body_header.inc.php':
  • '_body_footer.inc.php':

incs sometimes use template_include() but tend to use more template_container() and template tags(). incs usually have some good old fashioned html as well, so have fun with it but don't let it get you frustrated or pissed off. It ain't easy at first but it works so don't worry. Be Happy!

When incs play nice they close the html tags they open. You should write dot-incs that play nice :)


_foo.disp.php ("disps")

The full list of possible values for $disp, though most are handled as 'disps', is: arcdir', 'catdir', 'comments', 'feedback-popup', 'mediaidx', 'msgform', 'page', 'posts', 'profile', 'single', 'subs', and 'user'.

disps, or _something.disp.php files, can be thought of as "sub-templates". They build a specific piece of the requested page by using template_include() and template_container() and template tags and html, but they are not capable of building the whole page.

disps, or _something.disp.php files, are for cases where $disp might be something not item-related. For example your profile or subscriptions info.

lorem ipsum


chasing $params

template_container( 'Name' ) uses Template->container() which uses ComponentWidget->display() which uses ComponentWidget->init_display() which has a whole bunch of params so go check out what you can customize :)


template tags, listed ...

All remaining links on this page are to anchors in a tutorial file. Many include samples and/or defaults and/or examples. Many contain 'chasing $params' trails.

template_********() info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Blog->method() info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Comment->method() info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Item->method() info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Template Tags info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Miscellaneous->method() info/samples

Everything here is a link to an anchor in a tutorial file.

⇑⇑ top of page


Prev   Next
Quam Plures ~ many things template_********() info/samples