Hi,
I’m working on creating some dynamically created CSS, and I’ve run into an issue.
Here is my setup:
- my template includes a ccs page -- a text only page from the modx manager
- the css page calls the [[cssWrite]] snippet
- the [[cssWrite]] snippet contains the following code:
function tester(){
$testout = $modx->runSnippet('testsnip',array());
// testsnip code is simply:
// echo "Hello! The call to the testsnip snippet worked!";
echo $testout;
}
tester();
I get the error:
[tt]
Fatal error: Call to a member function runSnippet() on a non-object in /public_html/modx/assets/snippets/cssWrite/cssWrite.inc.php on line 75
[/tt]
if I run the contents of the tester function above (without it being part of a function), it works fine.
$testout = $modx->runSnippet('testsnip',array());
echo $testout;
It works, and I get:
[tt]
Hello! The call to the testsnip snippet worked!
[/tt]
I’m relatively new to PHP and MODx. Although I’ve found other people with instances of this problem, I haven’t really been able to get this working. An help would be much appreciated!