We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    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.]
      • 9995
      • 1,613 Posts
      fourroses666 Reply #2, 8 years ago
      Hmmm, if I remember this correct the baspath don't have to be changed in document.parser after a certain version of Evo. Its years ago I needed to do that but now .

      I thought you knew how to use custom TVs shocked
      You indeed have to add these custom TVs in send.php
        Evolution user, I like the back-end speed and simplicity smiley
        • 9995
        • 1,613 Posts
        fourroses666 Reply #3, 8 years ago
        Hmmm, if I remember this correct the baspath don't have to be changed in document.parser after a certain version of Evo. Its years ago I needed to do that but now .

        I thought you knew how to use custom TVs shocked
        You indeed have to add these custom TVs in send.php
          Evolution user, I like the back-end speed and simplicity smiley