Would be neat, but could also be BAAAD JUJU. Because effectively, there would need to be some kind of security model in place for Templates in stories otherwise the potential for site pwnage would be very high.

- Cliff

PS. If you wanted to do something like that, you could with a 2-phased template process approach. Instead of using the standard tags, you could use custom story tags of your own, ala:

blah blah content content...
<!+ IF !user.is_anon !+>
  Attached files:
  <ul>
   <li><slash-tag></li>
   <li><slash-tagforfile#2></li>
</ul>
<!+ END !+>

Where "<!+" and "!+>" are my lame attempts at custom tags. The reason for the 2-phased approach would solely be ease of implementation. Trying to do it in one phase right now would give me a massive coronary (considering my current migraine).

So the end of dispStory() should read something like this:

sub dispStory {
...
  if ($constants->{templates_in_stories}) {
    my($story, $body) = ($story->{introtext}, $story->{bodytext};
    my($tag) = '[% TAGS "<!+" "!+>" %]';
    $story = "$tag\n$story";
    $body = "$tag\n$body";
    slashDisplay($story,  {}, \$story);
    slashDisplay($body, {}, \$body);
    $story->{introtext} = $story;
    $story->{bodytext} = $body;
  }

  return slashDisplay($template_name, \%data, 1);
}

Or something like that. It's be a while so I might be missing the syntax of a rew things, but that's one way how it could be done. Note that this does not account for several pieces of the engine that I haven't had a chance to familiarize myself with... most notably story pre-rendering.

This is only a hint as to how it could be done. I'm sure many of you could do it better.

But for God's Sake, please read the non-postcript portion of this message again before attempting to implement something like this ];-}

- Cliff

On 8/29/06, shane <shane@lottadot.com> wrote:
Ya know what would be cool? Being able to embed Template toolkit
logic within a story text. ie

start new story
add content, save it, don't queue to show.
edit it later, upload file(s) into said story.
then when you edit the story

blah blah content content...
[% IF !user.is_anon %]
  Attached files:
  <ul>
   <li><slash-tag></li>
   <li><slash-tagforfile#2></li>
</ul>
[% END %]

then you could have story content show only for logged in users, or
only for subscribers, etc etc.

  Shane