Local Links External Links Contact Search this site |
XHP: PHP with XojoScript (or RbScript)Consider you want to process text with inline code, e.g. to repeat parts of a section, or to insert variable values. PHP does this for html pages. The XHP class I present here does the same using Xojo's own script language. The code for this is very simple. You add your own functions to the code via a Context class. Here's an example of a text with processing instructions: Begin ≤ if not true then ≥ Incorrect ≤ else ≥ Correct ≤ end ≥ And now a loop: ≤ dim i as integer ≥ ≤ for i = 1 to LoopLength ≥ Repeated multiple times (this is #≤ Print Str(i) ≥) ≤ next i ≥ Fin And the output after processing with XHP: Begin Correct And now a loop: Repeated multiple times (this is #1) Repeated multiple times (this is #2) Repeated multiple times (this is #3) Fin You can download the RealStudio/Xojo project here: http://files.tempel.org/RB/XHP.zip The code is free for you to use as you like. |