Answer the question
In order to leave comments, you need to log in
How to display data twice from a database table without duplicating code?
How in Yii 2 to immediately display a double set of data from one table without duplicating the code, one full, the other partial?
Example https://yadi.sk/i/Luz7-WfZ3LkrPY
On the left there are only 10 records (filtered by some attribute), on the right on the map all records from the table
Answer the question
In order to leave comments, you need to log in
give an example of a working code with duplication, and we will tell you what to fix.
ps. My option is to leave it as it is and continue to work on the rest of the functionality and start earning $ as soon as possible
How to immediately display a double set of data from one table in Yii 2 without duplicating the code
$data = Mymodel::find()->all(); //все записи
$data10 = array_slice($data, 10); //первые 10 из всех записей
$data = Mymodel::find()->all(); //все записи
//выводим первые 10
for($i=0;$<10;$i++){
echo $data[$i]->title;
}
//выводим все
foreach($data as $one){
echo $one->title;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question