Answer the question
In order to leave comments, you need to log in
How to populate an array in a FOREACH loop in MODX REVO?
There is such an array in the CMS MODX REVO plugin.
The essence of the plugin makes subdomains from the URL of the pages, but this is not about that.
Now 'pages1.site.ru' => 190, I add these entries by hand, but I want to do it automatically.
Each element of the array is an ALIAS and a page ID.
$domains = array (
'pages1.site.ru' => 190,
'pages2.site' => 161,
);
if(!$docs = $modx->getCollection('modResource', array(
'parent' => 15,
'published' => 1,
'deleted' => 0,
'searchable' => 1
))){return;}
$domains = array (
'pages1.site.ru' => 190,
'pages2.site' => 161,
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question