TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Can I remove the linebreak if the variable is empty?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Naume
Date: 2013-12-17
Time: 10:18

Can I remove the linebreak if the variable is empty?

Hi, can I remove a linebreak in my word template if the variable is empty? I have a user database where I want to export to a word template all works great but the problem is that all users haven't the same fields. In example one user haven't a phone number and in my template i wrote [user.phone] so how can i remove the whole line if this tag is empty? So remove the br or \n or \r

Thanks for help
By: Sarah
Date: 2013-12-17
Time: 17:14

Re: Can I remove the linebreak if the variable is empty?

Assuming you are using a block, you can use parameter magnet to delete the enclosing tag when the value is empty (http://www.tinybutstrong.com/manual.php#html_field_prm - scroll down a little).