且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

十月CMS路由

更新时间:2022-04-21 21:56:37

我猜 self :: MAMF_PAGE_DIR 是应用程序的完整基本路径.例如

I guess self::MAMF_PAGE_DIR is full base path your application. for example like

/var/www/vhosts/octdev/themes/responsiv-flat/

简而言之 \ View :: make 需要根目录的绝对路径

In short \View::make need absolute path from root

现在,它将尝试查找具有october-cms的 .htm 扩展名的文件.其他是 .blade .htm.blade 等..

now it will try to look file with configured extensions for october-cms its .htm. others are .blade and .htm.blade etc ..

因此,在您的情况下,(视图)文件名是'oferta.htm'..(点)会转换为'/'路径分隔符,因此请不要使用它,而只需使用 'oferta' ,因此它将检查页面目录中的所有可能值

so in your case (view)file name is 'oferta.htm' that .(dot) is translated to '/' path separator so just don't use it and just use 'oferta' so it will check all possible values in pages directory

  • oferta.htm
  • oferta.blade
  • oferta.htm.balde

添加.htm是自动的,因此您只需提供视图名称,它便会自动查找并工作

this adding .htm is automatic thing so you just need to provide name of view then it will find and work automatically

\Route::get('/oferty/{id}', function ($id = null) {

        $theme =  \Cms\Classes\Theme::getActiveTheme();
        $path = \Config::get('cms.themesPath', '/themes').'/'.$theme->getDirName();
        $this->assetPath = $path;
        $offer = new Offer();
        return \View::make(base_path() . $path . '/pages/' . 'oferta', ['offer' => $offer->getOfferById($id)]);

    });

这已经过测试,希望能对您有所帮助. 如果无法正常工作,请发表评论.

this is tested and working fine hope this will help you. if its not working please comment.