Loading Files - Archer70/desmond GitHub Wiki
Functions
There are two main ways of loading a Desmond file. One by using the Desmond PHP object, and the other by calling (load-file "path") from inside Desmond itself.
<?php
use Desmond\Desmond;
$lang = new Desmond();
$lang->loadFile('path/to/file.dsmnd');
And the other way:
(load-file "path/to/file.dsmnd")
File and Dir symbols
To help with loading files from within Desmond, there are a couple of file-level symbols that you can use to help navigate around files. These are _file and _dir, respectively. And they refer to the file and directory paths of the .dsmnd file. Like __DIR__ in PHP.
index.php
<?php
use Desmond\Desmond;
$lang = new Desmond();
$lang->loadFile('path/to/main.dsmnd');
main.dsmnd
(print-line _file)
(print-line _dir)
;#> /home/user/public_html/path/to/main.dsmnd
;#> /home/user/public_html/path/to