[PHP] Display Problemo
I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Display Problemo
I see 2 possibilities to go and 1 warning: 1th way to go: you insert another field into your db called originalCode for example where you insert the code also but don't modify it at all. If someone wants to download the code you fetch the code from that field 2th way to go: you stay with only 1 field holding the code snippet and you don't change the code when inserting but you use nl2br when displaying. Needs a bit more processing time (I don't think it's a lot) but needs less disk space than 1th way warning: don't try to get rid of BR tags or other things afterwards because you could run into unsolvable problems (what when a coder has BR in his code? You could destroy it!) I hope I could help Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch -- - Original Message - From: Lerp [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 5:27 PM Subject: [PHP] Display Problemo I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Display Problemo
1. what do you want the br tags to be? a simple str_replace('br','',$text) will strip the tags... 2. use pre html text /pre jack Lerp wrote: I have a small php app that I'm building to display, insert, edit, etc... various types of code snipits (asp, php, html, etc...) in a db. I also have a download option that creates a text file with the code that they've selected. I have 2 problems...the first is that when I go to view the text file I have all sorts of BR tags within the text, this is due to the nl2br function I used prior to the db insertion. How would I get rid of those? The seond problem is when a user goes to view an html code example on the webpage, say with a hyperlink, the hyperlink is made active replacing the code with the actual a href tag. Thx in advance, Lerp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]