Jump to content

Displaying 'tabs'?


Michdd

Recommended Posts

By 'tabs' I presume you are taking about extra whitespace that is not being parsed out.

 

nl2br will break all \n and the like into <br /> to form a linebreak the whitespace is going simply be a bunch of   characters.

 

Check with firebug and see if the   characters are there, if they are not check to see if they are being striped anywhere (before sending them to the database) or when retrieving them

Link to comment
https://forums.phpfreaks.com/topic/156834-displaying-tabs/#findComment-826111
Share on other sites

The <pre style="tab-interval: 5px;"> kinda works but it messed with my template.. And no, they're not stripped anywhere. If I display this is a <textarea> then the tabs show fine.

 

Edit: But if I look in the webpage source I can see the "tabs" the empty white space... I assume I could just do a str_replace.. but is there a better method?

 

Something like:

 

$variable = str_replace('	', '     ', $variable);

 

Works fine I'd just like to know if there's a better method.

Link to comment
https://forums.phpfreaks.com/topic/156834-displaying-tabs/#findComment-826131
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.