1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Phrase with parameter in templates?

Discussion in 'XenForo Development Discussions' started by Liam W, Jan 11, 2014.

  1. Liam W

    Liam W Well-Known Member

    How do you use a phrase with a parameter in templates?

    Without parameter:

    {xen:phrase phrase_name}
    With parameter...? Is it even possible?

  2. Chris D

    Chris D XenForo Developer Staff Member

    {xen:phrase phrase_name, 'parameter1=123', 'parameter2=456'}
    Marcus and Liam W like this.
  3. Liam W

    Liam W Well-Known Member

    Thanks, exactly what I needed :)
  4. TheJP

    TheJP Member

    Can someone name me a phrase with parameters or tell me how to create such a phrase?
  5. Vincent Gabriel

    Vincent Gabriel Active Member

    Just go to phrases -> add new phrase:

    Test Phrase {something}

    Parameter: something
    TheJP likes this.
  6. TheJP

    TheJP Member

    Thanks a lot, it worked. I did the following:

    Title: addonname_threads_list_deleted
    Phrase text: This thread, started by {create_user}, has been deleted by {deleted_user}, {deleted_date}
    Usage: {xen:phrase addonname_threads_list_deleted, 'create_user=User1', 'deleted_user=User2', 'deleted_date=Today'}

    Is it possible to replace User1 with <xen:username user="{$threads.create}" rich="true" />?
    zbahadir likes this.
  7. Vincent Gabriel

    Vincent Gabriel Active Member

    No, xen tags are not parsed within the phrase replacement variables.
  8. Bob

    Bob Well-Known Member

    I do it like this for many phrases, not sure if that is what you are asking if you can do or not.

    {xen:phrase nflj_sportsbook_x_liked_your_event_y,
                'user={xen:helper username, $user, 'primaryText'}',
                'title=<a href="{xen:link sportsbook, $content}" >{xen:helper sportsbookPrefix, $content}{$content.title}</a>'}
  9. TheJP

    TheJP Member

    This is exactly what I was searching for. Thank you.
  10. ForoStyle

    ForoStyle Active Member

    Thanks a lot (y)

Share This Page