Tags:
create new tag
, view all tags
In the edit action, specific TemplateTopic fields are expanded using

        my $foo = &TWiki::getLocaldate();
        $text =~ s/%<nop>DATE%/$foo/go;
        $text =~ s/%<nop>WIKIUSERNAME%/$wikiUserName/go;
        $text =~ s/%<nop>NOP%//go;  # Remove filler (there to prevent search from hitting a template)

I'm curious why this couldn't call, say, handleInternalTags instead?

The reason is I'm trying to instantiate templates that contain %WIKINAME% and %SERVERTIME%. I can think up uses for other things too, like %SEARCH%!

-- RobertWithrow - 10 Jan 2002

So, continuing along this line, I made the follwoing patch:

*** edit~       Fri Jan 11 10:58:06 2002
--- edit        Fri Jan 11 18:11:20 2002
***************
*** 132,141 ****
              $formTemplate = $args{"name"};
          }
  
!         my $foo = &TWiki::getLocaldate();
!         $text =~ s/%DATE%/$foo/go;
!         $text =~ s/%WIKIUSERNAME%/$wikiUserName/go;
!         $text =~ s/%NOP%//go;  # Remove filler (there to prevent search from hitting a template)
      }
      
      # parent setting
--- 132,138 ----
              $formTemplate = $args{"name"};
          }
  
!         TWiki::handleInternalTags($text, $topic, $webName);
      }
      
      # parent setting

...Which works fine for me. smile

But I wonder:

  • Is $topic the right thing to use here?
  • Is there some way to escape a variable so that it ends up in the interpolated template as a variable that will get expanded when the actual topic (created from the template) gets interpolated?
  • Is this fattening?

-- RobertWithrow - 11 Jan 2002

Refactored out SpacedTopicVariable discussions.

See related ExpandUrlParamForNewTopics

-- PeterThoeny - 28 Sep 2002

Topic revision: r8 - 28 Sep 2002 - 08:38:40 - PeterThoeny
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback