DenKuzmin Posted November 9, 2022 at 06:57 PM Share Posted November 9, 2022 at 06:57 PM Вывожу в слайдер картинки через модуль banner. Путь до картинок подставляю через banner[link] Как создать дополнительную переменную banner[link_mob], чтобы в пути до картинки заменить часть пути /desktop/ на /mobile/? Код контроллера banner: <?php class ControllerExtensionModuleBanner extends Controller { public function index($setting) { static $module = 0; $this->load->model('design/banner'); $this->load->model('tool/image'); $this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.carousel.css'); $this->document->addStyle('catalog/view/javascript/jquery/owl-carousel/owl.transitions.css'); $this->document->addScript('catalog/view/javascript/jquery/owl-carousel/owl.carousel.min.js'); $data['banners'] = array(); $results = $this->model_design_banner->getBanner($setting['banner_id']); foreach ($results as $result) { if (is_file(DIR_IMAGE . $result['image'])) { $data['banners'][] = array( 'title' => $result['title'], 'link' => $result['link'], 'class' => $result['class'], 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']) ); } } $data['module'] = $module++; return $this->load->view('extension/module/banner', $data); } } Хочу получить что-то вроде $data['banners'][] = array( 'title' => $result['title'], 'link' => $result['link'], 'link_mob' => $result['link_mob'], 'class' => $result['class'], 'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']) ); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.