Question
I am trying a different way to read my META data now. I am trying to write a plugin, but nothing is happening. In my topic I write:
%METADATA{type="PREFERENCE" name="LINK" key="value"}%
In my topic I have:
%META:PREFERENCE{name="LINK" title="LINK" value="TestTopic"}%
My plugin has the code:
sub commonTagsHandler {
return unless $_[0] =~ m/%METADATA%/g;
$_[0] =~ s/%METADATA%/_handleTag($_[0], $_[1], $_[2], $_[4])/ge;
}
# =========================
sub _handleTag {
my( $theText, $theTopic, $theWeb, $theMeta ) = @_;
if($theText =~ m/%METADATA{(.*)}%\n/g){
my %params = TWiki::Func::extractParameters($1);
my $att = $theMeta->get($params{type}, $params{name});
my $key = $params{key} || 'name';
return $att->{$key};
}
return '';
}
I am not an expert at PERL. I just copied and modified from other plugins.
Environment
--
GlennHart - 29 Apr 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
I figured it out. My search for the variable was incorrect.
--
GlennHart - 30 Apr 2008