|
...
|
...
|
@@ -41,7 +41,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateInfo(){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
$html = $this->getBodyHeaderFooter($info['html']);
|
|
|
|
$html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
|
|
|
|
$info['html'] = $this->getHeadFooter($html);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
...
|
...
|
@@ -59,7 +59,8 @@ 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'],'/<main>(.*?)<\/main>/s'));
|
|
|
|
$this->param['html'] = characterTruncation($this->param['html'],'/<main>(.*?)<\/main>/s');
|
|
|
|
$this->param['html_style'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-styles">(.*?)<\/style>/s');
|
|
|
|
}
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -94,7 +95,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/21 18:08
|
|
|
|
*/
|
|
|
|
public function getBodyHeaderFooter($preg_html){
|
|
|
|
public function getBodyHeaderFooter($preg_html,$html_style){
|
|
|
|
//获取设置的默认模版
|
|
|
|
$bSettingModel = new BSetting();
|
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
...
|
...
|
@@ -107,14 +108,20 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
]);
|
|
|
|
if(empty($preg_html)){
|
|
|
|
$preg_html = "<main></main>";
|
|
|
|
$html = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', "<style id='vvvebjs-styles'></style>", $TemplateInfo['html']);
|
|
|
|
}else{
|
|
|
|
$html = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']);
|
|
|
|
}
|
|
|
|
//删除内容
|
|
|
|
$html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $TemplateInfo['html']);
|
|
|
|
//删除样式
|
|
|
|
$html = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', "<style id='vvvebjs-styles'></style>", $html);
|
|
|
|
//内容
|
|
|
|
$html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setStyle($html){
|
|
|
|
//删除样式
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :拼接获取公共头部底部
|
|
|
|
* @name :getHeadFooter
|
...
|
...
|
|