Theme Syntax

This section explains how theme templates are constructed. You will generally not build a template file from scratch, but copy or modify an existing template.

The great news is that templates are mostly HTML and they can be maintained visually either within the RPGsp IDE or within any other HTML Designer. In addition to HTML, you can add special placeholders that are replaced during code generation. You can also add RPGLE script sections and RPG variables if necessary.

When a wizard generates an application, it goes through the following steps:

  1. Load the template file
  2. Add wizard-generated RPGLE code close to the top of the file
  3. Add wizard-generated RPGLE subroutines to the bottom of the file
  4. Replace any placeholders with the appropriate HTML code, RPGLE code, or RPG variables.

All special placeholders are surrounded by exclamation marks (!). You can also optionally surround them with variable symbols (<% and %>). For example...

This is a placeholder without variable symbols: !placeholder!

This is a placeholder with variable symbols: <%!placeholder!%>

The two placeholders above have the exact same meaning. The only difference is that <%!placeholder!%> will not appear in design or preview, while !placeholder! will. Choose the right format based on whether you want the placeholder to appear in design or preview.

If the placeholder has no visual meaning, like an if condition placeholder or a for loop placeholder, use a <%!placeholder!%> with variable symbols. If the placeholder is embedded inside an HTML element in such a way that it will confuse the HTML designer's rendering process, again use a <%!placeholder!%> with variable symbols.

However, if none of the above is true and you would like the placeholder represented in preview or design, use a !placeholder! without variable symbols.

Here is a list of actual placeholders recognized by RPGsp Wizards:

Placeholder Name Description Usage
title Replaced by the application title that is entered into the wizard. !title! or
<TITLE><%!title!%></TITLE>
rowcolor Replaced by the row color selected in the subfile wizard.  If the Alternate Row Color option is selected, the placeholder is replaced by the <% RowColor %> RPG variable, which is later populated by the generated code. <TR bgColor="<%!rowcolor!%>">
if lookup Determines if the Add Search/Lookup Capabilities option was selected in the subfile wizard.  If the option was not selected, the HTML code is omitted. <%!if lookup!%>
.... html code ....
<%!endif!%>
if page_at_a_time Determines if the Load Page at a Time option was selected in the subfile wizard. <%!if page_at_a_time!%>
.... html code ....
<%!endif!%>
if actions Determines if at least one action was selected in the subfile wizard. <%!if actions!%>
.... html code ....
<%!endif!%>
if view Determines if the view action was selected in the subfile wizard. <%!if view!%>
.... html code ....
<%!endif!%>
view The label for the view action. !view!
view_url The URL for the view action. <A href="<%!view_url!%>">
if change Determines if the change record action was selected in the subfile wizard. <%!if change!%>
.... html code ....
<%!endif!%>
change The label for the change record action. !change!
change_url The URL for the change record action. <A href="<%!change_url!%>">
if delete Determines if the delete action was selected in the subfile wizard. <%!if delete!%>
.... html code ....
<%!endif!%>
delete The label for the delete action. !delete!
delete_url The URL for the delete action. <A href="<%!delete_url!%>">
if other Determines if the other (or custom programmed) action was selected in the subfile wizard. <%!if other!%>
.... html code ....
<%!endif!%>
other The label for the other (or custom programmed) action. !other!
other_url The URL for the other (or custom programmed) action. <A href="<%!other_url!%>">
if add Determines if the add record action was selected in the subfile wizard. <%!if add!%>
.... html code ....
<%!endif!%>
add The label for the add record action. !add!
add_url The URL for the add record action. <A href="<%!add_url!%>">
endif Ends a conditional section of HTML code that was started by an if placeholder. <%!if actions!%>
.... html code ....
<%!endif!%>
for each key field Repeats a section of code for every key field in the selected database file. <%!for each key field!%>
.... html code ....
<%!next!%>
dow_top Inserts the top RPGLE script section of the Do-While loop in a subfile <%!dow_top!%>
dow_bottom Inserts the bottom RPGLE script section of the Do-While loop in a subfile <%!dow_bottom!%>
for each selected field Repeats a section of code for every database field you selected in the wizard. <%!for each selected field!%>
.... html code ....
<%!next!%>
next Ends a for group.  The code between the for and next placeholders is repeated.  The code after the next placeholder is not repeated. <%!for each key field!%>
.... html code ....
<%!next!%>
field_label Displays the field label within a for loop.  The field label is defined in the local database repository.  It is initially brought over from the iSeries database file field definitions. !field_label!
db_output Displays a field in a for loop as an output field.  The Output HTML is defined in the database repository. !db_output!
db_blank_input Displays a field in a for loop as a blank (or non-initialized) input field.  Blank Input HTML is defined in the database repository. !db_blank_input!
db_sticky_input Displays a field in a for loop as a sticky (or initialized) input field.  Sticky Input HTML is defined in the database repository. !db_sticky_input!
db_hidden Displays a field in a for loop as a hidden field. !db_hidden!

 

In addition to placeholders, you can utilize a number of special RPG variables that are referenced in the generated code. Here are a few of them:

 


Profound Logic Software, Inc.
www.ProfoundLogic.com
(937) 439-7925