<?php $res = $modx->db->select("content", "modx_site_content", "id=3");
$content = $modx->db->getRow($res);
echo $content['content']; ?><?php $rand = rand(3, 6);
$page_id = "id=" + $rand;
$res = $modx->db->select("content", "modx_site_content", $page_id);
$content = $modx->db->getRow($res);
echo $content['content']; ?>
I tried this to get random page id from 3 to 6 but didn’t work:
<?php $rand = rand(3, 6); $page_id = "id=" + $rand; $res = $modx->db->select("content", "modx_site_content", $page_id); $content = $modx->db->getRow($res); echo $content['content']; ?>
$input = array(3,6); $rand = array_rand($input);
$input = array(0,1,2,3,4,5,6,7,8,9); $rand = array_rand($input);
$input = array(4019,2,48,4011); $random_id = array_rand($input); $page_id = "id="+$random_id; echo $page_id;
$input = array(4019,2,48,4011);
$random_id = array_rand($input);
$page_id = $input[$random_id];
$page = "id="+$page_id;
$res = $modx->db->select("content", "modx_site_content", $page);
$content = $modx->db->getRow($res);
echo $content['content'];[!Ditto? &documents=`4019,2,48,4011` &display=`1` &randomize=`1` &tpl=`@CODE [+content+]`!]
$page = "id="+$page_id;
[!Ditto? &documents=`4019,2,48,4011` &display=`1` &randomize=`1` &tpl=`@CODE [+content+]`!]