Tags:
create new tag
view all tags

Question

I would like to add a custom meta data field for an add-on. I need another link to a topic other than the parent. I have tried modifying the Edit.pm, Save.pm, and Meta.pm files to add it, but have not had limited success. Is there any documentation on this or can somebody point me in the correct direction?

Environment

TWiki version: TWikiRelease04x02x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: WindowsXP
Web server: Apache 2.2
Perl version:  
Client OS: WindowsXP
Web Browser: Internet Explorer, Firefox
Categories: Add-Ons

-- GlennHart - 22 Apr 2008

Answer

ALERT! 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.
%META:FIELD{name="newfield" title="My new meta data field" value="Some value for the new meta data field named newfield."}%
%META:PREFERENCE{name="SOMEVARIABLE" title="SOMEVARIABLE" value="Some value for the new preference variable named SOMEVARIABLE."}%

Look at the debug version of this topic to see the meta data added by the above command.

Some value for the new preference variable named SOMEVARIABLE.

-- FranzJosefGigler - 22 Apr 2008

I wasn't specific enough. I want to be able to create the meta data as when I create a topic. I want to pass in a url parameter (like topicparent) and have the meta data created.

-- GlennHart - 22 Apr 2008

I figured out how to add to save.pm

   my $gh = $query->param( 'topiclink' );
   my $link1;
    if( $link ) {
           $link1 = { 'name' => $link };
    } elsif( $templateMeta ) {
        $link1 = $templateMeta->get( 'TOPICLINK' );
    } elsif( $prevMeta ) {
        $link1 = $prevMeta->get( 'TOPICLINK' );
    }
    $newMeta->put( 'TOPICLINK', $link1 ) if $link1;

I also had to add TOPICLINK to the list of meta variables in meta.pm.

I cannot figure out how to get the edit.pm to work.

-- GlennHart - 22 Apr 2008

I do not recommend to modify the core files, you will get in trouble on a TWiki upgrade. Better to create a plugin that handles your custom meta data. You can define your own %META:FOOBARPLUGIN{name="boing" foo="bar" et="cetera"}%

For details see TWikiPlugins, TWikiMetaData, TWikiMetaDotPm. To learn, study an existing plugin.

-- PeterThoeny - 22 Apr 2008

I'm still not convinced that this can't be done by (simply) using URLPARAM to fill a META:FIELD or whatever added to/in a topic template, but maybe I just don't understand the problem deeply enough. As far as I know you even don't need to have an explicit form added to the topic template to take advantage of (hidden) meta fields. Starting with the simple example in TWikiTemplates you can experiment. I don't think you need a new plugin to do what you want.

-- FranzJosefGigler - 23 Apr 2008

Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 03 Jun 2008

Change status to:
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2008-06-03 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.