Jump to content

reinstalled prestashop, errors with modules


Recommended Posts

i just reinstalled my prestashop on a new server and in the backoffice i get this error when i go on the 'modules' tab it gives me this error on a blank page

 

Parse error: syntax error, unexpected T_IF in /home/peaux743/public_html/modules/slider/slider.php on line 1
[PrestaShop] Fatal error in module slider:
syntax error, unexpected T_IF

 

any ideas?

Link to comment
Share on other sites

i don't have access to anything about the modules, it's just a blank page with written

Parse error: syntax error, unexpected T_IF in /home/peaux743/public_html/modules/slider/slider.php on line 1
[PrestaShop] Fatal error in module slider:
syntax error, unexpected T_IF

 

can't reset/do anything with any module

Link to comment
Share on other sites

i don't have access to anything about the modules, it's just a blank page with written

Parse error: syntax error, unexpected T_IF in /home/peaux743/public_html/modules/slider/slider.php on line 1

[PrestaShop] Fatal error in module slider:

syntax error, unexpected T_IF

 

can't reset/do anything with any module

 

can you attach the modules/slider/slider.php

 

it would seem it's corrupted

 

probably just need to re-ftp the file

Link to comment
Share on other sites

<?php
/**
 * NOTICE OF LICENSE
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * ...........................................................................
 *
 * @package   Slider
 * @author    Paul MORA
 * @copyright Copyright (c) 2012-2014 EURL ébewè - www.ebewe.net - Paul MORA
 * @license   MIT license
 * Support by mail  :  [email protected]
 */

if (!defined('_PS_VERSION_'))
	exit;

class Slider extends Module
{

 	function __construct()
 	{
 	 	$this->name = 'slider';
		$this->tab = 'front_office_features';
 	 	$this->version = 1.0;
		$this->author = 'ébewè - ebewe.net';
		$this->module_key = "XXXXXXXXXXXXXXXXXXXXXXX";
	 	parent::__construct();
		$this->page = basename(__FILE__, '.php');
	 	$this->displayName = $this->l('Slider');
	 	$this->description = $this->l('Add a slideshow to your homepage and manage it easily');
 	}

    function install()
    {
        if (!parent::install()
            || !$this->registerHook('Home')
			|| !$this->installModuleTab('Slideshow', array((int)(Configuration::get('PS_LANG_DEFAULT'))=>'Slider'), 'AdminParentModules')
            || !$this->_createtable()
            )
            return false;
        return true;
    }

    function uninstall()
    {
        if (!parent::uninstall()
			|| !$this->uninstallModuleTab('Slideshow')
            || !$this->_removetable()
            )
            return false;
        return true;
    }

    /**
    * install Tab
    *
    * @param mixed $tabClass
    * @param mixed $tabName
    * @param mixed $idTabParent
    */
    private function installModuleTab($tabClass, $tabName, $idTabParent)
    {
        $idTab = Tab::getIdFromClassName($idTabParent);
        $pass = true ;
        @copy(_PS_MODULE_DIR_.$this->name.'/logo.gif', _PS_IMG_DIR_.'t/'.$tabClass.'.gif');
        $tab = new Tab();
        $tab->name = $tabName;
        $tab->class_name = $tabClass;
        $tab->module = $this->name;
        $tab->id_parent = $idTab;
        $pass = $tab->save();

        return($pass);
    }

    /**
    * uninstall Tab
    *
    * @param mixed $tabClass
    */
    private function uninstallModuleTab($tabClass)
    {
        $pass = true ;
        @unlink(_PS_IMG_DIR_.'t/'.$tabClass.'.gif');
        $idTab = Tab::getIdFromClassName($tabClass);
        if($idTab != 0)
        {
            $tab = new Tab($idTab);
            $pass = $tab->delete();
        }
        return($pass);
    }
  
    /**
    * Create Table
    */

    public function _createtable()
    {
        $sql = '
        CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'slider` (
            `id_slider` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
            `id_lang` INT(10) NOT NULL ,
            `id_position` INT(10) NOT NULL ,
            `img` VARCHAR(500) NOT NULL ,
            `link` VARCHAR(500) NOT NULL ,
            `title` VARCHAR(500) NOT NULL ,
            `alt` VARCHAR(500) NOT NULL ,
            `active` TINYINT(1) NOT NULL
        ) ;
        ';

        if(!Db::getInstance()->Execute($sql))
        return false;

        return(true) ;
    }

    /**
    * Remove Table
    */

    public function _removetable()
    {
        $sql = '
            DROP TABLE IF EXISTS `'._DB_PREFIX_.'slider`;
        ';
        if(!Db::getInstance()->Execute($sql))
        return false;

        return(true);
    }                                                                                                                                                                                                         


    function hookHome($params)
 	{
        global $cookie, $smarty;

        $db = Db::getInstance();
        $iso = Language::getIsoById(intval($cookie->id_lang));
        
		$slides = $db->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'slider` WHERE `id_lang`='.$cookie->id_lang.' ORDER BY id_position ASC');
        $xml = simplexml_load_file(_PS_MODULE_DIR_.'slider/slider.xml');
        $nav = getimagesize(_PS_MODULE_DIR_.'slider/img/nivo_nav.png');
        $bullets = getimagesize(_PS_MODULE_DIR_.'slider/img/bullets.png');

        $smarty->assign(array(
            'slides' => $slides,
            'xml' => $xml,
            'nav' => $nav,
            'bullets' => $bullets,
            'this_path' => $this->_path
        ));
		return $this->display(__FILE__, 'slider.tpl');
 	}

    function hookTop($params)
 	{
		return $this->hookHome($params);
    }

    function hookdisplayTopColumn($params)
 	{
		return $this->hookHome($params);
    }
    
}

?>

here is the php code of slider.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...