On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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 3 years, 5 months 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
      • 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