Hello,
I am trying to put together a module that lets the user select a number of different items from a checklist, and then have one randomly displayed on one of two blocks generated by the module.
The trouble I am having is making sure the second block does not replicate the contents of the first one. Once I pick a random value, I can't seem to use it again to check the second value against as it keeps changing. Here's the relevant code from my preprocess function 'fluid list' is the array of values from the checkboxes.
These are both in the same hook_preprocess_block() function, but in different if statements.
Here's where I grab the first variable:
$vid_array = variable_get('fluid_list');
shuffle($vid_array);
$vid_array = array_values($vid_array);
variable_set('first_vid',$vid_array[0]);
it goes on to make some queries and set variables with the $vid_array[0] value
but then when I grab it again here:
$vid_array02 = array_values(variable_get('fluid_list02'));
$first_vid = variable_get('first_vid');
foreach($vid_array02 as $key => $value){
if($first_vid == $value){
$splice_here_key = $key;
break;
}
}
array_splice($vid_array02, $splice_here_key, 1);
$vid[0] = array_rand(array_flip($vid_array02), 1);