简体   繁体   中英

Impresspages 4 Model.php

I have Model.php:

<?php
/**
* @package   ImpressPages
*/

namespace Plugin\My_plugin_name;

class Model
{
public static function getVideoList()
{
    $videos = ipDb()->selectAll('plugin_db', '*', array('language'=> ipContent()->getCurrentLanguage()->getCode()), 'ORDER BY row_number ASC');
    return $videos;
}

}

But when I try to call to this function in Widget/some_plugin/skin/view.php

$videos = Model::getVideoList();

I get:

Fatal error: Class 'Model' not found in .......Widget/some_plugin/skin/view.php

I feel like I've already answered this question. You have to use full namespace:

$videos = \Plugin\MyPlugin\Model::getVideoList();

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