Php smarty在注释前后获取部分文本

Php smarty在注释前后获取部分文本,php,smarty,Php,Smarty,有一个文本包含 Lorem ipsum door sit amet,一位杰出的领导者。Mauris arcu sapien,ultrices quis ultrices vel,sodales pharetra massa。Donec iaculis hendrerit odio,您的设备是odio aliquet non。euismod nunc中的Phasellus,eget hendrerit侵权人。在门体中,turpis门ac.Aenean门与semper mi门相连。在犹他州的莫里斯拍

有一个文本包含

Lorem ipsum door sit amet,一位杰出的领导者。Mauris arcu sapien,ultrices quis ultrices vel,sodales pharetra massa。Donec iaculis hendrerit odio,您的设备是odio aliquet non。euismod nunc中的Phasellus,eget hendrerit侵权人。在门体中,turpis门ac.Aenean门与semper mi门相连。在犹他州的莫里斯拍卖行拍卖的孕妇的照片。nisl nunc中的Sed。

如何在smarty中获取注释前文本的第一部分(不包括注释本身)和注释后文本的第二部分(也不包括注释本身)

在下面的代码中,我得到了全文

{if $brand && $current_page_num==1}
  {$brand_descr="description_`$brand->url`"}
  {if $category->$brand_descr}
    {$category->$brand_descr}
  {/if}
{/if}

您可以在smarty中使用call php的reg_split:

{$description="/(\s*<!--[^>]*>\s*)+/"|preg_split:$category->$brand_descr}

Before: {$description.0}
After: {$description.1}

{$description=“/(\s*,如果不需要,请从正则表达式中删除\s*。

您可以在smarty中使用调用php的reg\u split:

{$description="/(\s*<!--[^>]*>\s*)+/"|preg_split:$category->$brand_descr}

Before: {$description.0}
After: {$description.1}

{$description=“/(\s*,如果不需要,请从正则表达式中删除\s*。

非常感谢您的帮助!非常感谢您的帮助!