Hi,
It's all about time and place, do not quite understand if you want to generate a pdf file in your call, or in the rendering of the page. in all cases there are dozens of ways to make this possible and even using MODx.
I think, could use a technique with FURL enabled and get a call type
<a href="dummyfile.pdf"> .. bla bla </ a>
and so a "MODx plugin" can do all the work(example use to "handle event" in this case the plugin will be executed before any other code).
I'm not sure, if you put the file, in the same place where the snippet is being executed, and in any case, this would be very dirty work, put the public files on the internal structure of MODx.
The best thing you could debugging your code on a local machine,
with zend studio, netbeans or another solution.
But fortunately exist others efficient ways to get output at runtime identification.
Such as whether you want to know the "dirname" current from a snippet before parsing, could use the statement (ONLY DEBUG PURPOSE!)
or post parsing a sentence, like:
echo '<script>alert("'.dirname(__FILE__).'");</script>';
note this is a very important development in the snippet,
All MODx tags are evaluated in the final output from the recognition of text and not at runtime, this means that if you call an
>>
['[ ++site_url ]']
its output will not be interpreted, if left to go on a post parsing if then be evaluated.
This can give you many problem if you use functions in external files that alter the execution flow of a snippet.
If for example you create an external file called: dummy.php
and placed inside , this code:
<?php
function dummyfunction($var)
{
echo '<script>alert("'.$var.'");</script>';
exit();
}
*note "
This is done in many library examples of treatment of output, or file streaming. Because in the example, you do not see this in a controlled setting, as in the case are running calls from within MODx."
and then includes the file in your snippet and call the function without processing the tag
require_once "dummy.php";
dummyfunction('[[++site_url]]');
will output this:
>>
['[ ++site_url ]']
and you should do weird things like this to process your "output":
dummyfunction(preg_replace(array('/\[\[/','/\]\]/'),'',$modx->getParser()->processTag(array('','[[++site_url]]'))));
>>
http:// www.dummysite.com
My advice is that if you are using MODx, try using the order of classes with native MODx MVC2 model, so may be more compatible with the security mechanisms of the system and will surely be easier to package your code to export to other facilities MODx.
I am also curious to know, where you copy your file. "txt" and what was the call and from where the error is probably due to a wrong analysis of the runtime.
Regards