Gantry::Template::Default - Default text plugin for Gantry.


Gantry documentation Contained in the Gantry distribution.

Index


Code Index:

NAME

Top

Gantry::Template::Default - Default text plugin for Gantry.

SYNOPSIS

Top

  use Gantry::Template::Default;




DESCRIPTION

Top

Use this module when you don't want templating:

    use Gantry qw/ -Engine=YourChoice -TemplateEngine=Default /;

Then, your controller should return plain text ready for immediate handing to the browser.

METHODS

Top

$site->do_action

do_action is a required function for the template plugin. It purpose is to call or dispatch to the appropriate method. This function is passed three parameters:

my( $self, $action, @path_array ) = @_;

This method is responsible for calling the controller method and storing the output from the controller.

$site->do_error

This method gives you the flexibility of logging, re-estabilishing a database connection, rebuilding the template object, etc.

$site->do_process

This method is the final step in the template plugin. Here you need call the template object passing the controller data and return the output.

$site->template_engine

Returns the name of the current template engine. (The one in this package always returns the package name.)

SEE ALSO

Top

Gantry(3), Gantry::Template::TT

LIMITATIONS

Top

AUTHOR

Top

Tim Keefer <tkeefer@gmail.com>

COPYRIGHT and LICENSE

Top


Gantry documentation Contained in the Gantry distribution.

package Gantry::Template::Default;
require Exporter;

use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );

############################################################
# Variables                                                #
############################################################
@ISA        = qw( Exporter );
@EXPORT     = qw( 
    do_action
    do_error
    do_process
    template_engine
);

@EXPORT_OK  = qw( );

############################################################
# Functions                                                #
############################################################
#-------------------------------------------------
# $site->do_action( 'do_main|do_edit', @p )
#-------------------------------------------------
sub do_action {
    my( $site, $action, @p ) = @_;
    
    $site->stash->controller->data( $site->$action( @p ) ); 
}

#-------------------------------------------------
# $site->do_error( @err )
#-------------------------------------------------
 sub do_error {
    my( $site, @err ) = @_;
    
    #$$site{r}->log_error( $msg ); 

}

#-------------------------------------------------
# $site->do_process( )
#-------------------------------------------------
sub do_process {
    my( $site ) = @_;
    
    return( $site->stash->controller->data );   

} # end do_process

#-------------------------------------------------
# $site->template_engine
#-------------------------------------------------
sub template_engine {
    return __PACKAGE__;
    
} # end template_engine

# EOF
1;

__END__