Add custom macro to RichEdit macro selection When you define custom macros and want them (this might not be wise in any case, since you don't want every macro to be added by every user) to appear in the RichEdit Add WebGUI macro pop-up the following file should be edited:
Convert to UTC Macro ^ConvertToUTC("Chicago/America","%F %R","2015-04-23","09:28:31");
FilePump This article has been merged into the main FilePump wiki page.
How to get currrent userId To get the userId of the currently logged in user, use the UserId macro. This macros is built into WebGUI and not an add-on.
html in macros Question: Is it possible to add an html link (a href=) inside a GroupText or Login Macro? Ie: ^GroupText("ContentManagers","Welcome CM, email me");
Karma macro Not checked/Incomplete, please help make this wiki better!!) At this moment there are two karma macros available:
LastModified Macro ^LastModified; ^LastModified("text","date format"); Displays the date that the current page was last edited. By default, the date is displayed based upon the user's date preferences. Optionally, it can take two parameters. The first is text to display before the date. The second is a date format string (see the date macro, ^D;, for details.
Login Box Macro ^L; or ^L(); - Login Box A small login form. This macro takes up to three parameters. The first is used to set the width of text boxes for entering the username and password: ^L(20);. This width is scaled by 2/3 if the user's browser isn't IE due to differences in the way that different browsers draw the text boxes. The second sets the message displayed after the user is logged in: ^L(20,"Hi ^a(^@;);. Click %here% if you have to scoot!");. Text between percent signs (%) is replaced by a link to the logout operation. The third parameter is the ID of a template in the Macro/L_loginBox namespace to replace the default template. The variables below are available for use in the template.
Login Toggle Macro ^LoginToggle; or ^LoginToggle(); Displays a "Login" or "Logout" message depending upon whether the user is logged in or not. You can optionally specify other labels like this: ^LoginToggle("Click here to log in.","Click here to log out.");. You can also use the special case ^LoginToggle(linkonly); to return only the URL with no label.
Make Page Printable Macro ^r(link text); ^r("",custom style name); ^r("",custom style id,custom template URL); Creates a link to alter the style from a page to make it printable.
New Mail Macro ^NewMail(); ^NewMail(CSS Class); This macro will display whether the current user has unread messages in their Inbox. If there are no unread messages, it will return nothing.
Page Macro ^Page(); This can be used to retrieve information about the current asset. For instance it could be used to get the page URL like this ^Page("urlizedTitle"); or to get the menu title like this ^Page("menuTitle");. If the macro is called outside the context of an asset, or if the property doesn't exist, then it returns nothing.
Page Title Macro ^PageTitle; Displays the title of the current page.
Page URL Macro ^PageUrl; ^PageUrl(/sub/page); ^PageUrl(/sub/page,param1=search); The URL to the current page (example: /index.pl/pagename).
Shopping Cart Macros These macros are used for interfacing with the WebGUI Shopping Cart introduced in WebGUI 7.5.
SpectreCheck macro A macro to return the status of Spectre. Added in 7.6?
Template Best Practices After spending many hours going through the core templates, I thought I'd make a list of best practices here for people to add to and update.
URL Encode Macro ^URLEncode(); This macro is mainly useful in SQL reports, but it could be useful elsewhere as well. It takes the input of a string and URL Encodes it so that the string can be passed through a URL. It's syntax looks like this: ^URLEncode("Is this my string?");
Using Macros WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail.
Widget Macro The widget macro can be used to syndicate an asset. The macro displayes some code to display the asset on another website. (Just like youtube allows you to embed a video.)