Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:14:01+00:00 2026-06-17T14:14:01+00:00

Working in an MVC application and getting an image array: Controller <?php // model

  • 0

Working in an MVC application and getting an image array:

Controller

<?php
// model
$this->load->model('catalog/manufacturer');
// data array
$this->data['manufacturers'] = array();
// database data
$results = $this->model_catalog_manufacturer->getManufacturers();
// populating array
foreach ($results as $result)
  {
  $this->data['manufacturers'][] = array(
    // HTTP_IMAGE is where images are stored
    'thumb' => HTTP_IMAGE . $result['image'],
    'href'  => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $result['manufacturer_id'])
  );
  }
// view
$this->render();
?>

Images are in different proportional sizes (squared, vertical and horizontal).

How can I order the array (before rendering) alternating one narrow image and one wider? (clients petitions are stranger than imagination).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:14:02+00:00Added an answer on June 17, 2026 at 2:14 pm

    What about doing something like this:

    1) Get every image, sort the list by aspect ratio

    2) Chop the list into the first half and the second half

    3) Alternate using images from the first half and from the second half, according to some algorithm (take from left, take from right or random for each half, so that’s 9 possibilities already)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a MVC application in which the Model is implemented using an
I'm working on an ASP.NET MVC application and just getting to error handling. Help
I've been working on this MVC 3 application on my home computer for a
I'm working on a web-application. I'm getting data from the DB, doing some computations
I am working on asp mvc application. I am generating charts depending upon data
I have an ASP.NET MVC 3 application that binds data to a Model. Simple
I'm starting out a Spring MVC 3.0 application and getting controllers and views working
I am working at an ASp.net mvc 3 project and I keep getting this
Im working on a MVC application, and was just wondering.. Should I be using
I am working on creating an MVC application for an existing Bug tracker of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.