Below is My Array. I want to make all possible combinations of array whose sum is equal to some number(e.g 20). The super parent array is continent and it's child array is it's countries and countries child array is its respective cities. i want to get all combinations of countries whose cities sum of days_range equal to some number(e.g 20). This is just a single continent array. it may be possible that the array is for other continents are also available.
Array
(
[1] => Array
(
[10] => Array
(
[0] => Array
(
[id] => 18
[city_name] => Baku
[country_id] => 10
[country_name] => Azerbaijan
[days_range] => 5
[continent_id] => 1
)
[2] => Array
(
[id] => 43
[city_name] => Lahıc
[country_id] => 10
[country_name] => Azerbaijan
[days_range] => 5
[continent_id] => 1
)
)
[23] => Array
(
[0] => Array
(
[id] => 42
[city_name] => Vientiane
[country_id] => 23
[country_name] => Laos
[days_range] => 7
[continent_id] => 1
)
[1] => Array
(
[id] => 47
[city_name] => Vang Vieng
[country_id] => 23
[country_name] => Laos
[days_range] => 3
[continent_id] => 1
)
)
[20] => Array
(
[0] => Array
(
[id] => 37
[city_name] => Tamsui District
[country_id] => 20
[country_name] => Taiwan
[days_range] => 1
[continent_id] => 1
)
[1] => Array
(
[id] => 35
[city_name] => Taipei
[country_id] => 20
[country_name] => Taiwan
[days_range] => 3
[continent_id] => 1
)
)
[22] => Array
(
[2] => Array
(
[id] => 46
[city_name] => Maolin District
[country_id] => 20
[country_name] => Taiwan
[days_range] => 3
[continent_id] => 1
)
[3] => Array
(
[id] => 36
[city_name] => Tainan
[country_id] => 20
[country_name] => Taiwan
[days_range] => 3
[continent_id] => 1
)
)
)
)
Below is my expected Output.
Array(
[0]=Array(
[0]=>[10],
[1]=>[23],
)
[1]=Array(
[0]=>[10],
[1]=>[20],
[2]=>[22],
)
[2]=Array(
[0]=>[23],
[1]=>[20],
[2]=>[22],
)
)
Related
I'm stuck on this problem and I hope someone can help me on that.
I have an array which I want to group by a specific key. The only problem is that I want to have a new array whenever the value of the key changes during the loop. Here is an example of the array.
Array
(
[0] => Array
(
[id] => 972
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[1] => Array
(
[id] => 644
[user_id] => 2
[user_field_48] => 4
[project] => 123 — QHV
[duration] => 15:00
[grouped_by] => 4
)
[2] => Array
(
[id] => 631
[user_id] => 2
[user_field_48] => 4
[project] =>
[duration] => -5:00
[grouped_by] => 4
)
[3] => Array
(
[id] => 630
[user_id] => 2
[user_field_48] => 1
[project] =>
[duration] => 22:00
[grouped_by] => 1
)
[4] => Array
(
[id] => 971
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[5] => Array
(
[id] => 973
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[6] => Array
(
[id] => 974
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
)
I did
foreach($report_items as $item)
{
$groupedItems[$item['grouped_by']][] = $item;
}
and I got
Array
(
[1] => Array
(
[0] => Array
(
[id] => 972
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[1] => Array
(
[id] => 630
[user_id] => 2
[user_field_48] => 1
[project] =>
[duration] => 22:00
[grouped_by] => 1
)
[2] => Array
(
[id] => 971
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[3] => Array
(
[id] => 973
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[4] => Array
(
[id] => 974
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
)
[4] => Array
(
[0] => Array
(
[id] => 644
[user_id] => 2
[user_field_48] => 4
[project] => 123 — QHV
[duration] => 15:00
[grouped_by] => 4
)
[1] => Array
(
[id] => 631
[user_id] => 2
[user_field_48] => 4
[project] =>
[duration] => -5:00
[grouped_by] => 4
)
)
)
What I'm actually looking for is something like this, where the arrays are separated during the loop and a suffix is added to the key whenever the value changes.
Array
(
[1.1] => Array
(
[0] => Array
(
[id] => 972
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
)
[4.1] => Array
(
[0] => Array
(
[id] => 644
[user_id] => 2
[user_field_48] => 4
[project] => 123 — QHV
[duration] => 15:00
[grouped_by] => 4
)
[1] => Array
(
[id] => 631
[user_id] => 2
[user_field_48] => 4
[project] =>
[duration] => -5:00
[grouped_by] => 4
)
)
[1.2] => Array
(
[0] => Array
(
[id] => 630
[user_id] => 2
[user_field_48] => 1
[project] =>
[duration] => 22:00
[grouped_by] => 1
)
[1] => Array
(
[id] => 971
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[2] => Array
(
[id] => 973
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
[3] => Array
(
[id] => 974
[user_id] => 2
[user_field_48] => 1
[project] => 100 — NLO
[duration] => 1:00
[grouped_by] => 1
)
)
)
I'm not really aware of a simple way to solve this, so I would appreciate any help. Thank you!
Not going to bother to recreate your full array here, I am using a reduced version with just the id and the grouped_by value, but the principle is of course exactly the same if you do it with your "full" array.
I am using a counter array to keep track of which "iteration" of a specific group we are currently dealing with. In classic control break implementation logic, I am comparing the grouped_by of the current record, with that of the previous one - if those differ, then the counter for this grouped_by value has to be incremented by 1. And then, I am simply creating the array key to use, by combining the grouped_by value, and the current count for it.
$data = [['id' => 972, 'grouped_by' => 1], ['id' => 664, 'grouped_by' => 4], ['id' => 631, 'grouped_by' => 4], ['id' => 630, 'grouped_by' => 1], ['id' => 971, 'grouped_by' => 1], ['id' => 973, 'grouped_by' => 1], ['id' => 974, 'grouped_by' => 1]];
$grouped_result = $grouped_by_counts = [];
$previous_grouped_by = null; // a value that will never occur in the data
foreach($data as $datum) {
if($datum['grouped_by'] !== $previous_grouped_by) {
$grouped_by_counts[$datum['grouped_by']] =
isset($grouped_by_counts[$datum['grouped_by']]) ?
$grouped_by_counts[$datum['grouped_by']] + 1 : 1;
}
$grouped_result[
$datum['grouped_by'].'.'.$grouped_by_counts[$datum['grouped_by']]
][] = $datum;
$previous_grouped_by = $datum['grouped_by'];
}
print_r($grouped_result);
Live example: https://3v4l.org/odtie
I have an array that is fetched from database using some bindModel in cakephp.
finally now I want to change its format according to my liking to own.
here is the array contains.
Array
(
[0] => Array
(
[DriverLocation] => Array
(
[id] => 1
[dispensary_id] => 1
[driver_id] => 85
[zip_code_id] => 42
[created] => 2015-05-25 12:01:14
)
[ZipCode] => Array
(
[id] => 42
[province_id] => 3846
[city] => Rohtak
[zip_code] => 30215
[status] => active
)
[UserProfile] => Array
(
[first_name] => Arman
[last_name] => Kumar
)
)
[1] => Array
(
[DriverLocation] => Array
(
[id] => 2
[dispensary_id] => 1
[driver_id] => 85
[zip_code_id] => 43
[created] => 2015-05-25 12:01:14
)
[ZipCode] => Array
(
[id] => 43
[province_id] => 3846
[city] => Rohtak
[zip_code] => 15478
[status] => active
)
[UserProfile] => Array
(
[first_name] => Arman
[last_name] => Kumar
)
)
[2] => Array
(
[DriverLocation] => Array
(
[id] => 3
[dispensary_id] => 1
[driver_id] => 77
[zip_code_id] => 41
[created] => 2015-05-25 12:45:47
)
[ZipCode] => Array
(
[id] => 41
[province_id] => 3846
[city] => Malviya Vihar
[zip_code] => 12558
[status] => active
)
[UserProfile] => Array
(
[first_name] => Manish
[last_name] => Kumar
)
)
)
I want to convert or change its format something like as follows.
This will altered on the behalf of DriverLocation=>driver_id
Array
(
[0] => Array
(
[DriverLocation] => Array
(
[id] => 1
[dispensary_id] => 1
[driver_id] => 85
[zip_code_id] => 42
[created] => 2015-05-25 12:01:14
)
[ZipCode] => Array
(
[0] => Array
(
[id] => 42
[province_id] => 3846
[city] => Rohtak
[zip_code] => 30215
[status] => active
)
[1] => Array
(
[id] => 43
[province_id] => 3846
[city] => Rohtak
[zip_code] => 15478
[status] => active
)
)
[UserProfile] => Array
(
[first_name] => Arman
[last_name] => Kumar
)
)
[1] => Array
(
[DriverLocation] => Array
(
[id] => 3
[dispensary_id] => 1
[driver_id] => 77
[zip_code_id] => 41
[created] => 2015-05-25 12:45:47
)
[ZipCode] => Array
(
[id] => 41
[province_id] => 3846
[city] => Malviya Vihar
[zip_code] => 12558
[status] => active
)
[UserProfile] => Array
(
[first_name] => Manish
[last_name] => Kumar
)
)
)
You can use this loop:
foreach($ar as $k1=>$a1){
foreach($ar as $k2=>$a2){
if($k1 < $k2 && $a1["DriverLocation"]["driver_id"] == $a2["DriverLocation"]["driver_id"]){
$ar[$k1]["ZipCode"][] = $a2["ZipCode"];
if(isset($ar[$k1]["ZipCode"]["id"])){
$ar[$k1]["ZipCode"][] = array("id"=>$ar[$k1]["ZipCode"]["id"]);
unset($ar[$k1]["ZipCode"]["id"]);
}
unset($ar[$k2]);
}
}
}
Use array_push() function to make it
for sample example
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
output
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
I have created an array which I need to show a list of projects for the current user. Each project is made up of stages, each stage can have multiple KPIs assigned to it.
As you can see the stages are appended to the array fine and for the most part so are the KPIs.
The exception to this is with KPIs that are not stage specific. When I have this type of KPI is should be assigned to the project section, as it spans multiple stages.
KPIs are assigned to stages by the PSID, if the id is null then it is a project wide KPI.
The issue I'm having is with the project wide KPIs. They are repeated, I need each KPI to appear once in the array.
I've tried to check the previously pushed array element with the currently pushed one in order to check.
$i=0;
foreach($projects as $project){
$projectStages = $this->ProjectStages->find('all',
array(
'conditions' => array(
'pid' => $project['Projects']['pid']
)
)
);
array_push($projects[$i], $projectStages);
$n=0;
foreach($projectStages as $stage){
$projectKPIs = $this->ProjectKPIs->find('all',
array(
'conditions' => array(
'nPid' => $project['Projects']['pid']
)
)
);
foreach($projectKPIs as $projectKPI){
if(empty($projectKPI['ProjectKPIs']['nPsid'])){
$N = $n-1;
$curpkid = $projectKPI['ProjectKPIs']['pkid'];
if(isset($projects[$i]['Projects'][$N]['ProjectKPIs']['pkid'])){
$prevpkid = $projects[$i]['Projects'][$N]['ProjectKPIs']['pkid'];
}else{
$prevpkid = null;
}
if($curpkid != $prevpkid){
echo 'cur: '.$curpkid.' - prev: '.$prevpkid;
array_push($projects[$i]['Projects'], $projectKPI);
}
}else if($projectKPI['ProjectKPIs']['nPsid'] == $stage['ProjectStages']['psid']){
array_push($projects[$i][$i][$n]['ProjectStages'], $projectKPI);
}
}
$n++;
}
$i++;
}
Below is the code I'm using and the array I'm currently getting back:
Array
(
[0] => Array
(
[Projects] => Array
(
[pid] => 811
[name] => Kpi Project
[description] => This Project Has Kpis
[scheduledStartDate] => 2015-05-01
[scheduledEndDate] => 2015-06-01
[actualStartDate] =>
[actualEndDate] =>
[pmid] => 1137
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 37
[nPsid] =>
[type] => 1
[start] => 2015-05-03
[end] => 2015-05-09
[nPid] => 811
[nKid] => 7
)
)
[1] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 37
[nPsid] =>
[type] => 1
[start] => 2015-05-03
[end] => 2015-05-09
[nPid] => 811
[nKid] => 7
)
)
[2] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 37
[nPsid] =>
[type] => 1
[start] => 2015-05-03
[end] => 2015-05-09
[nPid] => 811
[nKid] => 7
)
)
[3] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 37
[nPsid] =>
[type] => 1
[start] => 2015-05-03
[end] => 2015-05-09
[nPid] => 811
[nKid] => 7
)
)
[4] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 37
[nPsid] =>
[type] => 1
[start] => 2015-05-03
[end] => 2015-05-09
[nPid] => 811
[nKid] => 7
)
)
)
[pm] => Array
(
[first_name] => Mr
[last_name] => A
)
[0] => Array
(
[0] => Array
(
[ProjectStages] => Array
(
[psid] => 99
[pid] => 811
[stageID] => 1
[name] => 1
[description] => 1
[label] => 1
[actualStartDate] => 0000-00-00
[scheduledStartDate] => 2015-05-01
[actualEndDate] => 0000-00-00
[scheduledEndDate] => 2015-05-08
[prevStage] => n
[keyStage] => n
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 32
[nPsid] => 99
[type] => 0
[start] =>
[end] =>
[nPid] => 811
[nKid] => 2
)
)
)
)
[1] => Array
(
[ProjectStages] => Array
(
[psid] => 100
[pid] => 811
[stageID] => 2
[name] => 2
[description] => 2
[label] => 2
[actualStartDate] => 0000-00-00
[scheduledStartDate] => 2015-05-08
[actualEndDate] => 0000-00-00
[scheduledEndDate] => 2015-05-15
[prevStage] => n
[keyStage] => n
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 33
[nPsid] => 100
[type] => 0
[start] =>
[end] =>
[nPid] => 811
[nKid] => 4
)
)
)
)
[2] => Array
(
[ProjectStages] => Array
(
[psid] => 101
[pid] => 811
[stageID] => 3
[name] => 3
[description] => 3
[label] => 3
[actualStartDate] => 0000-00-00
[scheduledStartDate] => 2015-05-15
[actualEndDate] => 0000-00-00
[scheduledEndDate] => 2015-05-22
[prevStage] => n
[keyStage] => n
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 34
[nPsid] => 101
[type] => 0
[start] =>
[end] =>
[nPid] => 811
[nKid] => 5
)
)
)
)
[3] => Array
(
[ProjectStages] => Array
(
[psid] => 102
[pid] => 811
[stageID] => 4
[name] => 4
[description] => 4
[label] => 4
[actualStartDate] => 0000-00-00
[scheduledStartDate] => 2015-05-22
[actualEndDate] => 0000-00-00
[scheduledEndDate] => 2015-05-29
[prevStage] => n
[keyStage] => n
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 35
[nPsid] => 102
[type] => 0
[start] =>
[end] =>
[nPid] => 811
[nKid] => 6
)
)
)
)
[4] => Array
(
[ProjectStages] => Array
(
[psid] => 103
[pid] => 811
[stageID] => 5
[name] => 5
[description] => 5
[label] => 5
[actualStartDate] => 0000-00-00
[scheduledStartDate] => 2015-05-29
[actualEndDate] => 0000-00-00
[scheduledEndDate] => 2015-06-01
[prevStage] => n
[keyStage] => n
[0] => Array
(
[ProjectKPIs] => Array
(
[pkid] => 36
[nPsid] => 103
[type] => 0
[start] =>
[end] =>
[nPid] => 811
[nKid] => 8
)
)
)
)
)
)
[1] => Array
(
[Projects] => Array
(
[pid] => 572
[name] => Sgh
[description] => Dfgh
[scheduledStartDate] => 2015-04-01
[scheduledEndDate] => 2015-05-01
[actualStartDate] =>
[actualEndDate] =>
[pmid] => 3304
)
[pm] => Array
(
[first_name] => Mr
[last_name] => Brown
)
[0] => Array
(
)
)
)
It seems that you are retrieving the same exact database results multiple times. I'm looking at the find in this code block:
foreach($projectStages as $stage){
$projectKPIs = $this->ProjectKPIs->find('all',
array(
'conditions' => array(
'nPid' => $project['Projects']['pid']
)
)
);
// ...
}
It looks to me that you are going to get the same result set for $projectKPIs on each iteration of the foreach $projectStages because the find for ProjectKPIs is using the project id and nothing to do with whatever the current $stage is.
So effectively for every stage you then loop over all the same KPIs again, causing your logic to get convoluted trying to avoid duplicates.
Perhaps this can be simplified by restructuring your foreach loops. I would ditch the outer foreach($projectStages as $stage) and then iterate over all the KPIs only once. Then inside that loop iterate over each stage only when you need to test against the $stage['ProjectStages']['psid'], which may actually be unnecessary at that point.
I want to change an array format according to my needs. When I fetch data from a database using cakephp find('all') method, it returns something that is not in the format that I expected.
My resultant array is:
Array
(
[0] => Array
(
[DriverLocation] => Array
(
[id] => 15
[dispensary_id] => 1
[driver_id] => 85
[zip_code_id] => 43
[created] => 2015-05-20 12:25:34
)
[ZipCode] => Array
(
[id] => 43
[province_id] => 3846
[city] => Rohtak
[zip_code] => 15478
[status] => active
)
[UserProfile] => Array
(
[first_name] => Arman
[last_name] => Kumar
)
)
[1] => Array
(
[DriverLocation] => Array
(
[id] => 19
[dispensary_id] => 1
[driver_id] => 43
[zip_code_id] => 42
[created] => 2015-05-20 12:37:12
)
[ZipCode] => Array
(
[id] => 42
[province_id] => 3846
[city] => Rohtak
[zip_code] => 30215
[status] => active
)
[UserProfile] => Array
(
[first_name] => Pawan
[last_name] => Kumar
)
)
[2] => Array
(
[DriverLocation] => Array
(
[id] => 20
[dispensary_id] => 1
[driver_id] => 83
[zip_code_id] => 42
[created] => 2015-05-20 12:37:28
)
[ZipCode] => Array
(
[id] => 42
[province_id] => 3846
[city] => Rohtak
[zip_code] => 30215
[status] => active
)
[UserProfile] => Array
(
[first_name] => Ramesh
[last_name] => Saini
)
)
[3] => Array
(
[DriverLocation] => Array
(
[id] => 26
[dispensary_id] => 1
[driver_id] => 83
[zip_code_id] => 43
[created] => 2015-05-20 12:43:59
)
[ZipCode] => Array
(
[id] => 43
[province_id] => 3846
[city] => Rohtak
[zip_code] => 15478
[status] => active
)
[UserProfile] => Array
(
[first_name] => Ramesh
[last_name] => Saini
)
)
[4] => Array
(
[DriverLocation] => Array
(
[id] => 41
[dispensary_id] => 1
[driver_id] => 83
[zip_code_id] => 6
[created] => 2015-05-21 05:23:53
)
[ZipCode] => Array
(
[id] => 6
[province_id] => 3846
[city] => Whittier
[zip_code] => 90607
[status] => active
)
[UserProfile] => Array
(
[first_name] => Ramesh
[last_name] => Saini
)
)
)
And I want to convert it into something like this:
Array
(
[DriverLocation] => Array
(
[id] => 15
[dispensary_id] => 1
[driver_id] => 85
)
[ZipCode] => Array
(
[zip_code] => Array
(
[0] => 15478
)
[city] => Array
(
[0] => Rohtak
)
)
[UserProfile] => Array
(
[first_name] => Arman
[last_name] => Kumar
)
)
Array
(
[DriverLocation] => Array
(
[id] => 19
[dispensary_id] => 1
[driver_id] => 43
)
[ZipCode] => Array
(
[zip_code] => Array
(
[0] => 30215
)
[city] => Array
(
[0] => Rohtak
)
)
[UserProfile] => Array
(
[first_name] => Pawan
[last_name] => Kumar
)
)
Array
(
[DriverLocation] => Array
(
[id] => 20
[dispensary_id] => 1
[driver_id] => 83
)
[ZipCode] => Array
(
[zip_code] => Array
(
[0] => 30215
[1] => 15478
[2] => 90607
)
[city] => Array
(
[0] => Rohtak
[1] => Rohtak
[2] => Whittier
)
)
[UserProfile] => Array
(
[first_name] => Ramesh
[last_name] => Saini
)
)
Filter according to DriverLocation->driver_id
Seems that these arrays are exactly the same, except that you put every "record" of DriverLocation in its own variable. The idea here is that you receive the data from the DriverLocation Model in the fictional controller and put it in a variable; for example:
$allDriverLocations = $this->DriverLocation->find("all");
Now $allDriverLocations contains the first one of your mentioned arrays.
Next step is to pass it to the view:
$this->set(compact("allDriverLocations"));
And now to create a table in the associated view you should iterate through $allDriverLocations:
<table>
<tbody>
<?php
// Loop through the array with a foreach
foreach($allDriverLocations as $driverLocation){
// Create the table row here using the HtmlHelper.
// If you want to reach "Rohtak" for example, you use $driverLocation["Zipcode"]["city"] to print it.
}
?>
</tbody>
</table>
I wouldn't know why you should not follow Cake's easy conventions...
Hi my zend paginator works well when the $business_list array format is like below.
but when the array format changes it displays only one page instead of many pages.
$paginator = Zend_Paginator::factory($business_list);
Array
(
[0] => Array
(
[id] => 216
[userid] => 141
[title] => first req
[image] =>
[logo] =>
[description] =>
this is the first requirment
[date] => 2012-06-12 10:31:01
[area] => 1
[budget] => 1
[type] => 1
[status] => 1
[CmBusinessSection] => Array
(
[0] => Array
(
[id] => 315
[business_id] => 216
[section_id] => 1
[subsection_id] => 13
[description] =>
)
[1] => Array
(
[id] => 316
[business_id] => 216
[section_id] => 3
[subsection_id] => 14
[description] =>
)
[2] => Array
(
[id] => 317
[business_id] => 216
[section_id] => 4
[subsection_id] => 15
[description] =>
)
)
[CmUser] => Array
(
[id] => 141
[username] => venki
[password] =>
[firstname] => venkatesh
[lastname] => abus
[image] => 54winter.jpg
[email] => xxx#xx.com
[phone] => 23423452
[group_id] => 2
[status] =>
[registered_date] => 2012-06-04 06:32:58
[last_visit] => 0000-00-00 00:00:00
[is_active] => 1
[subscribe] => 1
)
)
[1] => Array
(
[id] => 214
[userid] => 98
[title] => gopicontractor
[image] => 54bluehills.jpg
[logo] => 239waterlilies.jpg
[description] =>
TIt uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is
[date] => 2012-06-11 12:18:58
[area] => 1
[budget] => 1
[type] => 3
[status] => 1
[CmBusinessSection] => Array
(
[0] => Array
(
[id] => 305
[business_id] => 214
[section_id] => 1
[subsection_id] => 5
[description] =>
)
[1] => Array
(
[id] => 306
[business_id] => 214
[section_id] => 1
[subsection_id] => 6
[description] =>
)
[2] => Array
(
[id] => 307
[business_id] => 214
[section_id] => 3
[subsection_id] => 1
[description] =>
)
[3] => Array
(
[id] => 308
[business_id] => 214
[section_id] => 4
[subsection_id] => 9
[description] =>
)
)
[CmUser] => Array
(
[id] => 98
[username] => gopi.s
[password] =>
[firstname] => venkatesh
[lastname] => franc
[image] =>
[email] => ss#ss.com
[phone] => 23423452
[group_id] => 3
[status] =>
[registered_date] => 2012-05-16 12:36:57
[last_visit] => 0000-00-00 00:00:00
[is_active] => 1
[subscribe] => 1
)
)
)
the above array format displays paginatin correctly.
This is the array that displays only one page in pagination.
Zend_Paginator Object
(
[_cacheEnabled:protected] => 1
[_adapter:protected] => Zend_Paginator_Adapter_Array Object
(
[_array:protected] => Array
(
[0] => Array
(
[id] => 89
[username] => xx
[password] => xx
[firstname] => xx
[lastname] => xx
[image] =>
[email] => xx#ymail.com
[phone] => 2342345
[group_id] => 2
[status] => offline
[registered_date] => 2012-05-15 10:58:53
[last_visit] =>
[is_active] => 1
[subscribe] => 0
[CmBusiness] => Array
(
[0] => Array
(
[id] => 204
[userid] => 89
[title] => xxhousing
[image] => 760067.jpg
[logo] => xx_818f3c97e6_o.jpg
[description] => xx
[date] => 2012-05-31 13:36:17
[area] => 1
[budget] => 1
[type] => 1
[status] => 1
[CmAmount] => Array
(
[id] => 1
[amount] => 1000-1500
[status] => 1
)
[CmBusinessSection] => Array
(
[0] => Array
(
[id] => 251
[business_id] => 204
[section_id] => 1
[subsection_id] => 6
[description] => xx
)
[1] => Array
(
[id] => 252
[business_id] => 204
[section_id] => 3
[subsection_id] => 2
[description] => xx
)
[2] => Array
(
[id] => 253
[business_id] => 204
[section_id] => 3
[subsection_id] => 4
[description] => xx
)
[3] => Array
(
[id] => 254
[business_id] => 204
[section_id] => 4
[subsection_id] => 9
[description] => xx
)
)
[CmArea] => Array
(
[id] => 1
[area] => manchester
[status] => 1
)
[CmType] => Array
(
[id] => 1
[type] => Personal business
[status] => 1
)
)
[1] => Array
(
[id] => 205
[userid] => 89
[title] => xx
[image] => 41217850-desktop-wallpapers-new-windows-xp.jpg
[logo] => 356anger_n.jpg
[description] => xx
[date] => 2012-05-31 13:37:15
[area] => 1
[budget] => 1
[type] => 3
[status] => 1
[CmAmount] => Array
(
[id] => 1
[amount] => 1000-1500
[status] => 1
)
[CmBusinessSection] => Array
(
[0] => Array
(
[id] => 255
[business_id] => 205
[section_id] => 1
[subsection_id] => 6
[description] =>xx
)
[1] => Array
(
[id] => 256
[business_id] => 205
[section_id] => 3
[subsection_id] => 1
[description] => xx
)
[2] => Array
(
[id] => 257
[business_id] => 205
[section_id] => 3
[subsection_id] => 2
[description] => xx
)
[3] => Array
(
[id] => 258
[business_id] => 205
[section_id] => 4
[subsection_id] => 10
[description] => xx
)
)
[CmArea] => Array
(
[id] => 1
[area] => manchester
[status] => 1
)
[CmType] => Array
(
[id] => 3
[type] => Bilde companies
[status] => 1
)
)
[2] => Array
(
[id] => 206
[userid] => 89
[title] => Nuestros recursos
[image] =>
[logo] =>
[description] => xx
[date] => 2012-05-31 13:38:04
[area] => 1
[budget] => 1
[type] => 4
[status] => 1
[CmAmount] => Array
(
[id] => 1
[amount] => 1000-1500
[status] => 1
)
[CmBusinessSection] => Array
(
[0] => Array
(
[id] => 259
[business_id] => 206
[section_id] => 1
[subsection_id] => 5
[description] =>
)
[1] => Array
(
[id] => 260
[business_id] => 206
[section_id] => 1
[subsection_id] => 6
[description] =>
)
[2] => Array
(
[id] => 261
[business_id] => 206
[section_id] => 3
[subsection_id] => 2
[description] =>
)
[3] => Array
(
[id] => 262
[business_id] => 206
[section_id] => 4
[subsection_id] => 10
[description] =>
)
)
[CmArea] => Array
(
[id] => 1
[area] => manchester
[status] => 1
)
[CmType] => Array
(
[id] => 4
[type] => Designer
[status] => 1
)
)
)
)
)
[_count:protected] => 1
)
[_currentItemCount:protected] =>
[_currentItems:protected] =>
[_currentPageNumber:protected] => 1
[_filter:protected] =>
[_itemCountPerPage:protected] => 2
[_pageCount:protected] => 1
[_pageRange:protected] =>
[_pages:protected] =>
[_view:protected] =>
)