Hi Everyone,
Here goes my first tip of the day. By using MODx2 or higher you can create powerful template variables (TVs) to do all kinds of things.
Today we will look at how we can create a TV and use the @EVAL binding to display the name of the user who?s currently logged into you web site.
1. Create a new TV and called Username
2. Select the Textarea Mini or Textarea input type
3. Inside the Default Value textbox, enter the following code:
@EVAL
global $modx;
return $modx->getLoginUserName();
4. Save your TV
That?s it for the Username TV. You can now add the TV to your documents or template by using [*Username*]. For example:
Welcome back [*Username*]
Best regards,