Okay, so I've been medling with the modRegistry for the entire day, but I can't quite get it to do as I want. Most likely I've misunderstood something in the instructions.
So, on one page I've got a snippet that does this:
<?php
$modx->getService('registry', 'registry.modRegistry');
$modx->registry->addRegister('productDates', 'registry.modDbRegister', array('directory' => 'productDates'));
$modx->registry->productDates->connect();
$modx->registry->productDates->subscribe("/dates/");
$modx->registry->productDates->send("/dates/", array("beer1", "beer2", "beer3"));
$msgs = $modx->registry->productDates->read(array(
'poll_limit' => 1,
'msg_limit' => 5
));
var_dump($msgs);
It outputs:
array(3) { [0]=> string(5) "beer1" [1]=> string(5) "beer2" [2]=> string(5) "beer3" }
Thats all good.
Now, I got to another page where I try to access that registry with this snippet:
<?php
$modx->getService('registry', 'registry.modRegistry');
$modx->registry->addRegister('productDates', 'registry.modDbRegister');
$modx->registry->productDates->connect();
$modx->registry->productDates->subscribe("/dates/");
$msgs = $modx->registry->productDates->read(array(
'poll_limit' => 1,
'msg_limit' => 5
));
var_dump($msgs);
But all I get is an empty array:
array(0) { }
What am I missing?
[ed. note: cruiser last edited this post 14 years, 3 months ago.]