Parsing Template Tag Arguments

The behavior of template tags can be modified programmatically through the use of template tag arguments. These arguments can be used to customize the output of a template tag according to the developer/designer's design. For example:

<MTEntries lastn="2" sort="created_on"></MTEntries>

In the example above, both "lastn" and "sort" are template tag arguments. Accessing the values passed to these template tags is done via the following code sample:

sub handler {
  my ($ctx, $args, $cond) = @_;
  my $lastn = $args->{lastn};
  my $sort = $args->{sort};
  # do something
}
This page was last updated on 2008-09-17, 14:41.  

Leave a note

Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation. Your note may be removed once it's contents has be integrated into the body of the page.