Hi,
I
have had a hard time trying to parse template variables from within the file ajax/send.php in TEMailer module, i.e. "outside" of MODx.
The warnings were such as:
Warning: include_once(manager/includes/tmplvars.format.inc.php) [function.include-once]: failed to open stream: No such file or directory in /home/www/users/1/n/1/2/n12345/www/some-site.com/manager/includes/document.parser.class.inc.php on line 1955
The reason was that in function getTemplateVarOutput
from file manager/includes/document.parser.class.inc.php
object "$this" did not exist.
The solution was to hardcode the path at row 1954 of file manager/includes/document.parser.class.inc.php, replacing
$baspath= $this->config["base_path"] . "manager/includes";
by
$baspath='/home/www/users/1/n/1/2/n12345/www/some-site.com/manager/includes';
In TEMailer's ajax/send.php, the TV are then inserted this way:
// replace template variables for proper output
// put here all TV, including custom ones
$body = insert('pagetitle', $doc['pagetitle'], $body);
$body = insert('longtitle', $doc['longtitle'], $body);
$body = insert('title', $tvs['title'], $body);
$body = insert('firstname', $tvs['firstname'], $body);
$body = insert('name', $tvs['name'], $body);
$body = insert('content', $intro . $doc['content'], $template['content']);
$body = insert('newsletter_colonne_de_droite', $tvs['newsletter_colonne_de_droite'], $body);
[ed. note: Jul last edited this post 8 years ago.]