help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Macros in pages

 

Since AxCMS.net 8.3.0, all page types (Page, Newsletter, MailTemplate) support macros in texts, meaning editor may insert special code in label text that are replaced with values during runtime from macro value container.

Following functionality is supported in macros:

  • {̣[Property]} - replaced with Property value of macro value container
  • {̣[Object.Property]} - replaced with Property value of Object property of macro value container
  • {̣[Func()]} - replaced with result of Func() function call of macro value container
  • {̣[Func(param)]} - replaced with result of Func() function call with string parameter param
  • {̣[@page.Property]} - replaced with Property value of current page object
  • {̣[@user.Property]} - replaced with Property value of current user object

Macros in Pages

AxPage has special property MacroValueContainer that contains the values for macros in page texts. By default it is current user. Developer can override this property (see Extending AxPage) and put another object there.

Macros in Newsletters and MailTemplates

Macro value container for newsletters and mailtemplates is INewsletterSubscriber interface implementation supplied when sending out newsletter or mailtemplate.

For newsletters, it is AxUser (or your override of AxUser, see Extending AxUser), but since you can override subscribers (see Overriding newsletter subscribers), you can supply other implementation of INewsletterSubscriber, which will be used as macro value container.

For mailtemplates, you supply INewsletterSubscriber implementation when sending mail out - any implementation will be used as macro value container in this case. See Sending out mail template.