Perlスクリプトによる定義

ディレクトリ階層構造

$MT_DIR/
|__ plugins/
|  |__ HelloWorld/
|     |__ hello_world.pl
|     |__ php
|         |__ function.mthello.php
 
 

Perlスクリプトでの定義

hello_world.pl

package MT::Plugin::HelloWorld;
 
use strict;
use base qw(MT::Plugin);
 
my $plugin = MT::Plugin::HelloWorld->new({
    id   =>  'helloworld',
    key  =>  'HelloWorld',
    name =>  'HelloWorld',
    registry => {
        tags => {
            function => {
                'Hello' => \&hdlr_hello,
            },
        },
    }
});
 
MT->add_plugin($plugin);
 
sub hdlr_hello{
    return 'Hello World';
}
 
1;
 
 

php/function.mthello.php

<?php
function smarty_function_mthello($args, &$ctx){
    return 'Hello World Test';
}
?>
 
 


最終更新:2012年03月02日 00:11