Jump to content

PHP Array Error??


Recommended Posts

Hello all,

 

I have just downloaded a home banner module for opencart and after trying to get in touch with the original author, it looks like his not supporting his work correctly and im stuck with TWO PHP errors.

 

Warning: Invalid argument supplied for foreach() on line 22. Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag on line 25.

 

The code is as follows:-

 

<?php
/*
Homepage Slideshow v1.0
Brought to you by Readyman - www.alreadymade.com
*/

class ControllerModuleHomepageslideshow extends Controller {

protected function index() {
	//$this->language->load('module/homepageslideshow');
    	//$this->data['heading_title'] = $this->language->get('heading_title');
	//$this->load->model('tool/seo_url');

        $this->data['config_url'] = $this->config->get('config_url');
        $this->data['delay'] = $this->config->get('homepageslideshow_delay');
        $this->data['speed'] = $this->config->get('homepageslideshow_speed');
        $this->data['pause'] = $this->config->get('homepageslideshow_pause');
        $this->data['height'] = $this->config->get('homepageslideshow_height');
        $this->data['width'] = $this->config->get('homepageslideshow_width');

        $a = unserialize($this->config->get('homepageslideshow_slide_image'));
        foreach ($a as $key => $row) {
            $sorting[$key]  = $row['sortorder'];
        }
        array_multisort($sorting, SORT_ASC, $a);
        $this->data['slide_images'] = $a;
	$this->id = 'homepageslideshow';

	if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/homepageslideshow.tpl')) {
		$this->template = $this->config->get('config_template') . '/template/module/homepageslideshow.tpl';
	} else {
		$this->template = 'default/template/module/homepageslideshow.tpl';
	}

	$this->render();
    }



}

 

 

any help would be greatly appreciated!!

Link to comment
https://forums.phpfreaks.com/topic/264636-php-array-error/
Share on other sites

Thanks for the reply! Is there anyway i could remove that or simply change the way its written. The actual application itself works. I think they are just warning errors.

 

How would you go about changing that function?

 

I'm not hot on PHP, that's why i have posted lol.

 

An help would be great!

Link to comment
https://forums.phpfreaks.com/topic/264636-php-array-error/#findComment-1356444
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.