Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

using function result as attribute to another function

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jn
Smarty Rookie


Joined: 29 Sep 2003
Posts: 7
Location: Germay

PostPosted: Sun Oct 05, 2003 2:44 pm    Post subject: using function result as attribute to another function Reply with quote

The title says it: Can a result of a function be an attribute of another function:

Here is a sample:

Code:
    {assign var="foo" value="bar"}
      {$foo}
      <hr>
      {mailto address="me@domain.com"}
      <hr>
    {assign var="foo" value=mailto address="me@domain.com"}
      {$foo}      
      <hr>
    {assign var="foo" value=`mailto address="me@domain.com"`}
      {$foo}      
      <hr>
    {assign var="foo" value="`mailto address=me@domain.com`"}
      {$foo}      
      <hr>
    {assign var="foo" value={mailto address="me@domain.com"}}
      {$foo}
      <hr>
    {assign var="foo" value="{mailto address="me@domain.com"}"}
      {$foo}
This give sme the folloging output:
Quote:
bar
--
me@domain.com
--
mailto
--
`mailto
--
`mailto address=me@domain.com`
--
} {mailto
--
"} "{mailto address="me@domain.com
Of course, the first two are only as a soft of self-control if the assign and the mailto functions are working by themselfes...

Now, the question is: how to I get the results of the mailto function to be the attribute of the assign function? As you see, backticks are not working. Using
Code:
{assign var="foo" value="`mailto address="me@domain.com"`"}
even gives me a syntax error in the compiled template!

(please note that assign and mailto are here just as examples, I need this mechanism for a couple of selfmade plugins)

Any help is greatly appreciated,


Jörg
Back to top
View user's profile Send private message
Troublegum
Smarty Rookie


Joined: 07 Sep 2003
Posts: 33
Location: Germany

PostPosted: Sun Oct 05, 2003 4:09 pm    Post subject: Reply with quote

I am using {capture} for such purposes.
http://smarty.php.net/manual/en/language.builtin.functions.php#LANGUAGE.FUNCTION.CAPTURE
But I am interested in an alternative solution, too.
Back to top
View user's profile Send private message
jn
Smarty Rookie


Joined: 29 Sep 2003
Posts: 7
Location: Germay

PostPosted: Sun Oct 05, 2003 6:05 pm    Post subject: Reply with quote

Thank you very much, Troublegum; that did it and solved my problem. Not very intuitive....

BTW: searching the forums for "capture" I found a thread I didn't find previously here. This thread which covers my problem as well.

Tschö,

Jörg
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP