Changeset 2745

Show
Ignore:
Timestamp:
07/10/08 01:38:34 (19 months ago)
Author:
bchoate
Message:

Moved some pod docs to MT, since the methods had been promoted there.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/lib/MT/App.pm

    r2741 r2745  
    33463346The  
    33473347 
    3348 =head2 $app->template_paths 
    3349  
    3350 Returns an array of directory paths where application templates exist. 
    3351  
    3352 =head2 $app->find_file(\@paths, $filename) 
    3353  
    3354 Returns the path and filename for a file found in any of the given paths. 
    3355 If the file cannot be found, it returns undef. 
    3356  
    3357 =head2 $app->load_tmpl($file[, @params]) 
    3358  
    3359 Loads a L<MT::Template> template using the filename specified. See the 
    3360 documentation for the C<build_page> method to learn about how templates 
    3361 are located. The optional C<@params> are passed to the L<MT::Template> 
    3362 constructor. 
    3363  
    3364 =head2 $app->set_default_tmpl_params($tmpl) 
    3365  
    3366 Assigns standard parameters to the given L<MT::Template> C<$tmpl> object. 
    3367 Refer to the L<STANDARD APPLICATION TEMPLATE PARAMETERS> section for a 
    3368 complete list of these parameters. 
    3369  
    3370 =head2 $app->charset 
    3371  
    3372 Gets or sets the application's character set based on the "PublishCharset" 
    3373 configuration setting or the encoding of the active language 
    3374 (C<$app-E<gt>current_language>). 
    3375  
    33763348=head2 $app->add_return_arg(%param) 
    33773349 
     
    34713443 
    34723444This method is deprecated. 
    3473  
    3474 =head2 $app->static_path 
    3475  
    3476 Returns the application's static web path. 
    34773445 
    34783446=head2 $app->takedown 
     
    35883556child objects were changed during the application request. 
    35893557 
    3590 =head2 $app->build_page($tmpl_name, \%param) 
    3591  
    3592 Builds an application page to be sent to the client; the page name is specified 
    3593 in C<$tmpl_name>, which should be the name of a template containing valid 
    3594 L<MT::Template> markup. C<\%param> is a hash ref whose keys and values will 
    3595 be passed to L<MT::Template::param> for use in the template. 
    3596  
    3597 On success, returns a scalar containing the page to be sent to the client. On 
    3598 failure, returns C<undef>, and the error message can be obtained from 
    3599 C<$app-E<gt>errstr>. 
    3600  
    3601 =head3 How does build_page find a template? 
    3602  
    3603 The C<build_page> function looks in several places for an app 
    3604 template. Two configuration directives can modify these search paths, 
    3605 and application and plugin code can also affect them. 
    3606  
    3607 The I<TemplatePath> config directive is an absolute path to the directory 
    3608 where MT's core application templates live. It defaults to the I<mt_dir> 
    3609 plus an additional path segment of 'tmpl'. 
    3610  
    3611 The optional I<AltTemplatePath> config directive is a path (absolute 
    3612 or relative) to a directory where some 'override templates' may 
    3613 live. An override template takes the place of one of MT's core 
    3614 application templates, and is used interchangeably with the core 
    3615 template. This allows power users to customize the look and feel of 
    3616 the MT application. If I<AltTemplatePath> is relative, its base path 
    3617 is the value of the Movable Type configuration file. 
    3618  
    3619 Next, any application built on the C<MT::App> foundation can define 
    3620 its own I<template_dir> parameter, which identifies a subdirectory of 
    3621 TemplatePath (or AltTemplatePath) where that application's templates 
    3622 can be found. I<template_dir> defaults to C<cms>. Most templates will 
    3623 be found in this directory, but sometimes the template search will 
    3624 fall through to the parent directory, where a default error template 
    3625 is found, for example. I<template_dir> should rightly have been named 
    3626 I<application_template_dir>, since it is application-specific. 
    3627  
    3628 Finally, a plugin can specify its I<plugin_template_path>, which 
    3629 locates a directory where the templates for that plugin's own 
    3630 interface are found. If the I<plugin_template_path> is relative, it 
    3631 may be relative to either the I<app_dir>, or the I<mt_dir>; the former 
    3632 takes precedence if it exists. (for a definition of I<app_dir> and 
    3633 I<mt_dir>, see L<MT>) 
    3634  
    3635 Given these values, the order of search is as follows: 
    3636  
    3637 =over 4 
    3638  
    3639 =item * I<plugin_template_path> 
    3640  
    3641 =item * I<AltTemplatePath> 
    3642  
    3643 =item * I<AltTemplatePath>F</>I<template_dir> 
    3644  
    3645 =item * I<TemplatePath>/I<template_dir> 
    3646  
    3647 =item * I<TemplatePath> 
    3648  
    3649 =back 
    3650  
    3651 If a template with the given name is not found in any of these 
    3652 locations, an ugly error is thrown to the user. 
    3653  
    3654 =head2 $app->build_page_in_mem($tmpl, \%param) 
    3655  
    3656 Used internally by the L<build_page> method to render the output 
    3657 of a L<MT::Template> object (the first parameter) using the parameter 
    3658 data (the second parameter). It additionally calls the L<process_mt_template> 
    3659 method (to process any E<lt>MT_ACTIONE<gt> and E<lt>MT_X:YE<gt> marker tags) 
    3660 and then L<translate_templatized> (to process any E<lt>MT_TRANSE<gt> tags). 
    3661  
    3662 =head2 $app->process_mt_template($str) 
    3663  
    3664 Processes the E<lt>MT_ACTIONE<gt> tags that are present in C<$str>. These tags 
    3665 are in the following format: 
    3666  
    3667     <MT_ACTION mode="mode_name" parameter="value"> 
    3668  
    3669 The mode parameter is required (and must be the first attribute). The 
    3670 following attributes are appended as regular query parameters. 
    3671  
    3672 The MT_ACTION tag is a preferred way to specify application links rather 
    3673 than using this syntax: 
    3674  
    3675     <TMPL_VAR NAME=SCRIPT_URL>?__mode=mode_name&parameter=value 
    3676  
    3677 C<process_mt_templates> also strips the C<$str> variable of any tags in 
    3678 the format of C<E<lt>MT_\w+:\w+E<gt>>. These are 'marker' tags that are 
    3679 used to identify specific portions of the template page and used in 
    3680 conjunction with the transformer callback helper methods C<tmpl_prepend>, 
    3681 C<tmpl_append>, C<tmpl_replace>, C<tmpl_select>. 
    3682  
    36833558=head2 $app->tmpl_prepend(\$str, $section, $id, $content) 
    36843559