#Hello? Plugin of Movable Type 3.2
#aklaswad 2006 feb 5th
#this plugin just add a MTtag that print "hello?"
package MT::Plugin::Hello; #Declare the Module space (Namespace?) in Perl
use strict; #this line force to the code to be Gentle to Declare
use base 'MT::Plugin'; #Load MT Module?
use vars qw($VERSION); #Version
$VERSION = '1.0';
use MT; #Load MT Module?
use MT::Template::Context; #Load MT Module?
#Constractor of my plugin class
my $plugin = MT::Plugin::Hello->new({
name => 'Hello? Movable Type',
description => "say Hello?",
doc_link => 'http://www.sixapart.jp',
author_name => 'aklaswad',
author_link => 'http://www.aklaswad.com/',
version => $VERSION,
});
MT->add_plugin($plugin); #pass my plugin class to MT
#Add an External tag's name and that's routine's address
MT::Template::Context->add_tag(Hello => \&tag_hello);
#My new External MTtag's code
#return balue will output to the document
sub tag_hello {
# get arguments
my ($ctx, $args) = @_;
my $name = $$args{"name"};
"hello? $name"; #return value
}
1;
MTHello?
プラグインを作ったりしたい。
という事で試みに作ってみたプラグインである。九割がぱくりである。一応動く。
ちなみに perl の知識は殆ど無いので、必要の無いコードが混じっていたりするかもしれません。
仕様 : hello?
仕様2 : アトリビュート "Name" で指定した名前に hello?以下、そのコード。コメントはかっこつけマンなので英語にした。多分どこか変。