在 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();
?>
图像具有不同的比例大小(平方、垂直和水平)。
如何订购阵列(在渲染之前)交替一个窄图像和一个宽图像?(客户的请愿书比想象的更奇怪)。