There’s a very strange behaviour when I use:
$modx->runSnippet('NewsPublisher', $Params);
Here it is: I have a "test" node (page) with this code:
"show_section_editor" is a snippet with the following code:
<?php
$Params['folder'] = 15; // I have a node with id 15, where I want to store the composed article
$Params['formtpl'] = 'news_form';
$Params['makefolder'] = '0';
$Params['rtcontent'] = 'tvnews_content';
$Params['lang'] = 'it';
$Params['clearcache'] = '1';
$html = $modx->runSnippet('NewsPublisher', $Params);
?>
With everything in place, this one works good when I call in my browser:
http://localhost/myproject/test.html
and I submit the article: it’s stored in the folder node #15.
The problem is: that 15 has not to be hardcoded, it should be a value from a GET variable. That is, the snippet I need working is:
<?php
echo $_GET['section'];
$Params['folder'] = $_GET['section']; // the node id where I want to store the composed article is passed via GET
$Params['formtpl'] = 'news_form';
$Params['makefolder'] = '0';
$Params['rtcontent'] = 'tvnews_content';
$Params['lang'] = 'it';
$Params['clearcache'] = '1';
$html = $modx->runSnippet('NewsPublisher', $Params);
?>
So, I call in the browser:
http://localhost/myproject/test.html?section=15
What I see, is the "15" echoed by the first line of the snippet, then I have the NewsPublisher form; now, when I submit some content, if I look into the node #15 I can’t find it.
Summying up: if I hardcode the value (15), everything works; while if I take it as the value of a GET variable (which btw echoed is 15, effectively), no way. I’ve also tried with some conversions (intval, strval, settype, ...), but really, no way.
Please let me know what you think about this issue, and how I should solve it.