[Petal] Creating a mailto href tag

William McKee william@knowmad.com
Fri, 26 Jul 2002 08:20:07 -0400


On 26 Jul 2002 at 12:06, Jean-Michel Hiver wrote:
> Your problem here is that the TAL concept makes it very hard (if not
> impossible) to concatenate string. 

Unless I create a modifier that does concatenation. I seem to recall an example you 
gave that showed a modifier receiving two parameters. If it can take two, I presume 
it could take more. If it could also accept a string instead of a variable name, then 
that would work even better (one less variable to pass to the template). Granted, I 
realize that modifiers are not part of the TAL spec but hey we've already crossed 
that line <g>. I'm seeing something like the following:

  <a petal:attr="href :cat 'mailto:' email">someone@foo.com</a>

I'm not sure I can pass a modifier as the second argument in a petal:attr tag, 
though.

> Is going to make a lot of WYSIWYG editors very upset. But in this case you
> can be saved by the magical dollar :+) So what I'd do would be:

Yeah, I suspect you're right about that syntax making the GUI editors unhappy. 
However, I really don't like the idea of using plain Perl variables in my templates; I 
can't put my finger on it, but something bothers me about it. If the above wouldn't 
work, I'd prefer to create an :href modifier tag that would would like:
 
  <a petal:attr=":href email" petal:content="email">someone@foo.com</a>

I guess that'll be my first contribution to the codebase (besides debugging).

Thanks,
William
-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com