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

Add $user to my template

Discussion in 'XenForo Development Discussions' started by Marc, Mar 6, 2011.

  1. Marc

    Marc Well-Known Member

    I am trying to move what I have done in a listener over to a template, however in order to do this I need to return the users status. In the message_user_info template I can retrieve this by simply using $user.status and I would like to do this from my own template.

    I have added a template and added $user.status into it, then in the message_user_info added
    HTML:
    	<xen:include template="myTemplate" />
    
    which returns the text $user.status rather than the value of it. So looking at the templates more I figured thats what the following should do.

    HTML:
     	<xen:include template="myTemplate">
    		<xen:map from="$user" to="$user" />
    	</xen:include>
    
    which is obviously a complete guess, as I was guessing that this maps the variable to my template.. Guessing not lol.

    Please could someone let me know how I acheive this?

    PS:- I will probably be the highest user of this section of the board in the next few days LMAO
     
  2. Kier

    Kier XenForo Developer Staff Member

    Variables have to be surrounded in curly braces when you want to output them:

    <p>$user.status</p> // prints $user.status
    <p>{$user.status}</p> // prints I ate some cheese.
     
    Marc likes this.
  3. Marc

    Marc Well-Known Member

    Ahhhhhhhhh I see :) Cheers Kier
     

Share This Page