How to remove extra gaps in smarty's conclusion



  • There's a problem with deleting the headings from the table into a yii2 with smarty The headline is released through this team:

    <strong>Объект «{$object->name|safe}»</strong>

    and the code makes something like that:

    <strong>Объект «Заголовок                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                » </strong>

    i.e., a large number of gaps are inserted after the heading, and the different number of gaps for any headings appears to depend on the length of the heading. So we need to remove the gaps if they're more than two in a row, and I can only do it all at once:

    Объект «{$object->name|safe|regex_replace:"/\s+/":""}» 

    Please tell me how to remove all the gaps if there are more than two. I would be grateful if you could help with regular expressions or tell them what gaps might be added.



  • Based on description Smarty Use the retrofit. stripwhich replaces repeated gaps per gap

    <strong>Объект «{$object->name|safe|strip}»</strong>
    

    or retrofit regex_replace regular /\s+$/ (she'll only take the gaps at the end of the line)

    <strong>Объект «{$object->name|safe|regex_replace:"/\s+$/":""}»</strong>
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2