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

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2002-09-28 - 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.