Local Links

External Links


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:

    ≤ if not true then ≥
    ≤ else ≥
    ≤ end ≥

    And now a loop:
    ≤ dim i as integer ≥
    ≤ for i = 1 to LoopLength ≥
      Repeated multiple times (this is #≤ Print Str(i) ≥)
    ≤ next i ≥


And the output after processing with XHP:


    And now a loop:
      Repeated multiple times (this is #1)
      Repeated multiple times (this is #2)
      Repeated multiple times (this is #3)


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.

Page last modified on 2021-01-05, 12:41 UTC (do)
Powered by PmWiki