MVCアプリケーションでの作業と画像配列の取得:
コントローラ
<?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();
?>
画像はさまざまな比例サイズ(正方形、垂直、水平)になっています。
狭い画像と広い画像を交互に(レンダリングする前に)配列を並べ替えるにはどうすればよいですか?(クライアントの請願は想像よりも奇妙です)。