|
...
|
...
|
@@ -41,10 +41,8 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateInfo(){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if(!empty($info['html'])){
|
|
|
|
$html = $this->getBodyHeaderFooter();
|
|
|
|
$info['html'] = $this->getHeadFooter($html);
|
|
|
|
}
|
|
|
|
$html = $this->getBodyHeaderFooter($info['html']);
|
|
|
|
$info['html'] = $this->getHeadFooter($html);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
...
|
...
|
@@ -61,7 +59,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
public function customTemplateSave(){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
if(isset($this->param['html']) && !empty($this->param['html'])){
|
|
|
|
$this->param['html'] = $this->getHeadFooter(characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s'));
|
|
|
|
$this->param['html'] = $this->getHeadFooter(characterTruncation($this->param['html'],'/<main>(.*?)<\/main>/s'));
|
|
|
|
}
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -96,8 +94,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/21 18:08
|
|
|
|
*/
|
|
|
|
public function getBodyHeaderFooter(){
|
|
|
|
$html = '';
|
|
|
|
public function getBodyHeaderFooter($preg_html){
|
|
|
|
//获取设置的默认模版
|
|
|
|
$bSettingModel = new BSetting();
|
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
...
|
...
|
@@ -108,7 +105,10 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source'=>1//首页
|
|
|
|
]);
|
|
|
|
$TemplateInfo['html'] = preg_replace('/<main>.*<\/main>/', "<main></main>", $TemplateInfo['html']);
|
|
|
|
if(empty($preg_html)){
|
|
|
|
$preg_html = "<main></main>";
|
|
|
|
}
|
|
|
|
$html = preg_replace('/<main>.*<\/main>/', $preg_html, $TemplateInfo['html']);
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|