![]() |
Loop through multiple array concat and sort by value - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html) +--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html) +--- Thread: Loop through multiple array concat and sort by value (/thread-64045.html) |
Loop through multiple array concat and sort by value - sebastianvirlan - 01-06-2016 I have a array that describe a database table and it's relations. Assume we have a products table with following fields:
and based on the table I create a object with the details. PHP Code: Array How can I loop this array in view so I can get the labels to create a table with the following thead ordered by position? Column1 | Category Name | Column2 | Column Three | Image Name When merging the arrays must check if a field from main table has same name with from relation table and if yes add a suffix. RE: Loop through multiple array concat and sort by value - PaulD - 01-07-2016 I would suggest that you build your page array in a controller or library and only pass the data to your page that your view actually requires and in a format fit for that view. This will help you to avoid complex array manipulation within a view. |