Printing Templates
From FreemedDeveloperWiki, the FreeMED developers' Wiki.
As of version 0.8.0, there is a new type of printing template in FreeMED. Templates are kept in the lib/tex subdirectory of the FreeMED tree.
Contents |
Tags
field
The field tag allows a field from the current database record to be directly imported into TeX. This tag respects HTML and plain text formatting, translating basic HTML to basic TeX, as well as escaping control sequences.
- Syntax: **field:fieldname:optional-format**
if and fi
These tags are used as a pair to allow conditional TeX generation.
- Syntax: **if:condition-type:variable:optional-value:other-optional-value**
- Syntax: **fi**
| exists | Opposite of not. (Returns true if the string is non-NULL or not equal to 0.) |
| equals | String or value comparison. |
| lengthge | True if length of variable is greater or equal to optional-value. |
| lengthle | True if length of variable is less than or equal to optional-value. |
| linkexists | variable is in the format field,table ; if the field optional-value in table table exists, returns true. |
| linklengthge | variable is in the format field,table ; if the length of field optional-value in table table is greater or equal to other-optional-value, returns true. |
| linklengthle | variable is in the format field,table ; if the length of field optional-value in table table is less than or equal to other-optional-value, returns true. |
| module | Calls function optional-value in module variable with the record field column other-optional-value. If the module's method returns true, this condition succeeds. |
| not | Basic PHP false comparison. Will return true if the string is NULL or 0. |
link
The link tag provides a method to pull a relational database field from another database table, based on the relational link, and provides basic formatting.
- Syntax: **link:field-name:table:target-field:optional-format**
| date | Date formatting using fm_date_print(). |
| fixcase | Attempt to provide case correction |
| phone | Phone number formatting with "(XXX) XXX-XXXX" format. |
| ssn | Social security number formatting, ex: "XXX-XX-XXXX" |
method
The method tag allows the ability to execute a method in any object in the system.
- Syntax: **method:object-name:method-name:link-field**
Please note that the object name is called as _FreeMED.object-name using phpwebtools' "CreateObject()" object loader.
module
The module tag is like the method tag, but executes a method in any module in the system.
- Syntax: **module:module:method:field**
field is the column name that is passed from the current record.
TeX Caveats
Custom Page Sizes
When using pdflatex (part of the standard TeTeX distribution), page size needs to be declared in addition to the standard TeTeX page size. From http://www.tug.org/pipermail/pdftex/2000-November/000162.html :
When using pdftex with latex, pdflatex, the paper size is determined
\pdfpagewidth and \pdfpageheight
\setlength{\pdfpagewidth}{8in}
\setlength{\pdfpageheight}{8in}
Does the trick.
