I have two arrays, Forms and formsShared.
<?php foreach ($Forms as $r): ?>
$("#shareform<?=$r['Form']['id'];?>").hide();
$(".Share<?=$r['Form']['id'];?>").click(function(){
$("#shareform<?=$r['Form']['id'];?>").toggle("show");
});
<?php endforeach; ?>
Currently, I have this hide and toggle function for each Form in the Forms array. I want these functions to be enabled for the forms in the formsShared array also.
If I add another for loop for FormsShared,like
$("#shareform<?=$r['Form']['id'];?>").hide();
$(".Share<?=$r['Form']['id'];?>").click(function(){
$("#shareform<?=$r['Form']['id'];?>").toggle("show");
});//.Share click
<?php endforeach; ?>
I achieve what I want,But it seems to be a repetition of the same code.
Is there any way in cakePHP to loop through 2 arrays in a single for loop?