<![CDATA[ [Solved] Parse TVs from TEMailer's, file "outside" MODX - MODX Community Forums]]> https://forums.modx.com/thread/?thread=99763 <![CDATA[ [Solved] Parse TVs from TEMailer's, file "outside" MODX]]> https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539618
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);
]]>
Jul Mar 15, 2016, 08:09 AM https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539618
<![CDATA[Re: [Solved] Parse TVs from TEMailer's, file "outside" MODX]]> https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539659
I thought you knew how to use custom TVs shocked
You indeed have to add these custom TVs in send.php]]>
fourroses666 Mar 16, 2016, 06:01 AM https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539659
<![CDATA[Re: [Solved] Parse TVs from TEMailer's, file "outside" MODX]]> https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539658
I thought you knew how to use custom TVs shocked
You indeed have to add these custom TVs in send.php]]>
fourroses666 Mar 16, 2016, 06:01 AM https://forums.modx.com/thread/99763/parse-tvs-from-file-outside-modx#dis-post-539658