The EZGenerator macros play the role of a connection between the databases information and the web pages.
They are a very basic and quick to learn scripting system that enables you to program EZGenerator to insert content from any database field in certain places inside your web pages.
This way you can design only the general page layout and let EZGenerator build the rest automatically depending on the data you have entered in your databases.
Basic Rules
The macros can be inserted anywhere in your web page, as they are simple text. However, for EZGenerator to be able to tell that certain text is a part of macros, they have specific syntax - all macros are enclosed in percent characters ("%"). In this example:
My name is %myname%. Welcome to my site.
"myname" is considered a macro by EZGenerator, so it is going to look for such database field to replace the macros with the actual value of the "myname" field. Let's imagine that such field exists and its value is "John Smith". Then the sentence above is rendered like this in the final web site:
My name is John Smith. Welcome to my site.
Of course, this is a basic example, as you can use the same or similar syntax to insert images, buttons, rich text articles etc. If in the above example "myname" was a field holding an image logo, the resulting page would replace the macros with that image instead.
It is important to understand that macros interpretation always depends on the page type they are used in. To learn about the available data sources, special fields and objects for each page type, see Page Types.
Functions
The functions described below allow you to modify the fields appearance and formatting or create procedurally new content in your web page (for ex. insert the current date).
Image Scaling
Syntax
%SCALE(%ImageField%,MaxHeight,MaxWidth)%
Where ImageField is the name of an image field accessible from the current page, and MaxHeight and MaxWidth are the maximum height and width (in pixels) of the image field.
Description
This function scales down an image to ensure it is not larger than the sizes specified in the function. If the image is smaller, it is not resized.
Buttonize
Syntax
%BUTTON(%Field%)%
Where Field is the name of a field accessible from the current page.
Description
This function renders the text content of a field (this includes also fields that can be rendered as text, for ex. numbers) as a button graphic, according to the current Web Template style. Note that this doesn't create a clickable button, but it useful as a decoration element or as a table header.
Trim Text
Syntax
%
Where Field is the name of a field accessible from the current page, StartIndex is the first letter to be included in the result, EndIndex is the last letter to be included in the result.
The first letter in a field has Index of 1.
Description
This function trims the field's text context according to the StartIndex and EndIndex properties.
For example:
Fie
returns "rim", where %Field% is a text field containing the value "Trimmed".
Current Date
Syntax
%DATE(Format String)%
Where Format String describes the formatting of the date to be inserted (see below).
Format String syntax
Example: %DATE(mmmm/dd/yyyy)%
Format Specificator | Description |
d | Displays the day as a number without a leading zero (1-31). |
dd | Displays the day as a number with a leading zero (01-31). |
ddd | Displays the day as an abbreviation (Sun-Sat). |
dddd | Displays the day as a full name (Sunday-Saturday). |
m | Displays the month as a number without a leading zero (1-12). |
mm | Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed. |
mmm | Displays the month as an abbreviation (Jan-Dec). |
mmmm | Displays the month as a full name (January-December). |
yy | Displays the year as a two-digit number (00-99). |
yyyy | Displays the year as a four-digit number (0000-9999). |
hh | Displays hour. |
nn | Displays minutes. |
ss | Displays seconds. |
Description
Inserts the current date in the web page, according to the Format String parameter.
IF
Syntax
%IF(condition, value-if-true, value-if-false)%
more info here
Description
The IF macro will check the logical condition of a statement and return one value if true and a different value if false.
Disable Page Footer
Syntax
%NOPAGEFOOTER%
Description
This function disable page footer on current page.
Sitemap
Syntax
%SITEMAP%
Description
This function generates a sitemap containing text links to each of the pages linked in the main navigation menu.
Sorted Site Index
Syntax
%ABSITEMAP%
Description
This function generates an index (sorted in alphabetical order) for all pages in the site.
Vertical Site Map
Syntax
%CATEGORY-SITEMAP%
Description
This function generates a vertical list of links to the main site sections. This macro is automatically generated by the Ver Sitemap field in the Footer page.
Horizontal Site Map
Syntax
%CATEGORY-SITEMAP-HOR%
Description
This function generates a horizontal list of links to the main site sections. This macro is automatically generated by the Hor Sitemap field in the Footer page.
Clock Display
Syntax
%MENU-COMBOBOX%
Description
This function generates a drop-down menu containing links to each of the pages linked in the main navigation menu.