作者 lyh

gx

... ... @@ -87,7 +87,7 @@ class BTemplateLogic extends BaseLogic
}
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
$type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型
$commonInfo = $this->getCommonPage(['template_id'=>0,'project_id'=>$this->user['project_id'],'type'=>$type]);//获取定制头部
$commonInfo = $this->getCommonPage(0,$this->user['project_id'],$type);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
return $this->success(['html'=>$html,'template_id'=>$template_id]);
}
... ... @@ -106,10 +106,12 @@ class BTemplateLogic extends BaseLogic
* @time :2023/12/13 15:39
*/
public function handleAllHtml($commonInfo,$html){
$html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html);
$html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html);
$html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html);
$html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html);
if(!empty($commonInfo)){
$html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html);
$html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html);
$html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html);
$html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html);
}
return $html;
}
... ...