plainblack.com
Username Password
search
Bookmark and Share

Macro: PageIfElse

Macro for pulling metadata or data from the Asset in which it's embedded.
If the first choice is not defined, will return the second choice passed to this routine, from the Asset in which it's embedded.

For example, imagine you have a metadata property called "custom_text".
Use this Macro to display the "custom_text" text if present for the current page, or something else such as the page menuTitle if "custom_text" is not filled in for the current page.


Usage example
^PageIfElse("metadata.your_custom_field", "menuTitle");
^PageIfElse("metadata.your_custom_field");

To get metadata, prepend the metadata name with "metadata."

If the second argument is omitted, the second argument will be the Title from the Asset in which it's embedded.

If the macro is called from outside of an Asset, or if there's no asset in session variable, returns an empty string.

Disclaimer:
I am not a professional perl programmer. Use at your own risk.
Tested on WebGUI 7.10.28-stable.

System Requirements

Enable Metadata in general settings if you want to use the metadata features.

Comments
5ehab: "We need more macros like this :)"
0yqert: "aaaaa"
5abcd1234: "asdasd"
5abcd1234: "asda"
0abcd1234: "adasd"
1abcd1234: "safdaf"
DownloadPageIfElse_pm.txt PageIfElse_pm.txt
LinksRanks NL
No Support Offered
Statistics Downloads: 1201
Views: 5225
Rating: 4
Updated: 2/10/2014
Keywords ifelse macro meta metadata
NavigationMore from Ranks NL
Back to the Bazaar
© 2023 Plain Black Corporation | All Rights Reserved