默认模板路径

app/code/<模块名>/View 完整的路径 app/code/Cms/View
html模板以xxx.phtml结尾,及其他静态文件。 我可以将所有模块下的View 目录文件可以进行迁移到 skin/frontend/template 目录下面
只要将配置 app/etc/Config.php 文件中的 template dir 改为 skin/frontend/template 然后运行迁移工具即可
同时系统支持后台模板以及样式切换

 'template' => [ 'dir' => "app/code/" //模板路径默认路径 app / code / 前后端分离的路径 skin / frontend / template ],

单独渲染模板


<?php 
use Weicot\Core\View;

    /**
     * 编辑亚马逊模板
     * @return string
     */
    function editAmzTemplate()
    {
        $template = new ExpTemplate();
        $id = $this->get("id");
        if ($id) {
            $dataInfo = $template->getUserTemplateById($id);
            if (!empty($dataInfo)) {
                $tplData = $dataInfo[0];
                $tplData['country_options'] = $this->getCountry($tplData['country']);
                $tplData['type_options'] = $this->getTemplateType($tplData['type']);
                $content = View::render([
                    'data' => $tplData,
                    "template" => 'Export/View/Template/info',
                    "output" => false
                ]);
                return $content;
            }
        }
        return '没有找到模板';
    }

results matching ""

    No results matching ""