简体   繁体   中英

Joomla error Class 'JModelLegacy' not found

When I am using a specific module in my Joomla website, I am getting this error

 Class 'JModelLegacy' not found in sitename/modules/mod_map/helper.php on line 8

Helper file includes this code:

<?php

defined('_JEXEC') or die;

jimport('joomla.application.component.model');
JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models');

class mod_mapHelper{

    public function getPlace($params){

        $things = Array();

        $things['name'] = $params->get('placeName');
        $things['lat'] = $params->get('latitude');
        $things['long'] = $params->get('longitude');
        $things['zoom'] = $params->get('zoom');

        return $things;

    }

How can I fix this error?

I believe JModelLegacy was added into Joomla 2.5 (not sure on the exact version) therefore Joomla 1.7 does not support this.

So you need to simply change JModelLegacy::addIncludePath to JModel::addIncludePath

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM