28.03.2024, 23:55 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]

Neues Thema eröffnen   Neue Antwort erstellen
Vorheriges Thema anzeigen Druckerfreundliche Version Einloggen, um private Nachrichten zu lesen Nächstes Thema anzeigen
Autor Nachricht
jesseman
Titel: A bit of a strange request ...  BeitragVerfasst am: 22.05.2006, 17:07 Uhr



Anmeldung: 01. Feb 2006
Beiträge: 37
Wohnort: Summerville, SC
I need your help in setting up a script. I post news for a large online gaming league. Now, although it is in HTML, I have to post the news via forum. The forum interprets all tabs and carriage returns in my HTML. This means my readable code renders real crazy in the forums.

So, I need a script to remove all tabs and carriage returns. Help!
 
 Benutzer-Profile anzeigen Private Nachricht senden  
Antworten mit Zitat Nach oben
zulu9
Titel: A bit of a strange request ...  BeitragVerfasst am: 22.05.2006, 19:23 Uhr



Anmeldung: 31. Jul 2004
Beiträge: 249

there may be a better/faster/easier way, but you could try use perl.
in perl,there is a function, which cuts off the CR at the end of a line.
chomp($var);

_________________
http://kanotix.wordpress.com/ inoffizielles Kanotix-Blog
 
 Benutzer-Profile anzeigen Private Nachricht senden  
Antworten mit Zitat Nach oben
markb
Titel: RE: A bit of a strange request ...  BeitragVerfasst am: 22.05.2006, 23:20 Uhr



Anmeldung: 09. Aug 2004
Beiträge: 121
Wohnort: Brisbane Australia
Code:
tr -d '\t\r'
 
 Benutzer-Profile anzeigen Private Nachricht senden  
Antworten mit Zitat Nach oben
h2
Titel: RE: A bit of a strange request ...  BeitragVerfasst am: 23.05.2006, 00:18 Uhr



Anmeldung: 12. Mar 2005
Beiträge: 1005

PHP:
// data in form field:
$formdata = $_POST['form field name'];// replace with real form input data names
$replace_stuff = array("\r\n","\n","\t");// str_replace will use this array to search for all present array items
$cleaned_form_field_data = str_replace( $formdata, '', $replace_stuff);

I think that will do it.

_________________
Read more on dist-upgrades using du-fixes-h2.sh script.
New: rdiff-backup script
 
 Benutzer-Profile anzeigen Private Nachricht senden  
Antworten mit Zitat Nach oben
jesseman
Titel: RE: A bit of a strange request ...  BeitragVerfasst am: 23.05.2006, 13:04 Uhr



Anmeldung: 01. Feb 2006
Beiträge: 37
Wohnort: Summerville, SC
I will be trying markb and h2's ideas later today. Results will be coming! Thanks guys!
 
 Benutzer-Profile anzeigen Private Nachricht senden  
Antworten mit Zitat Nach oben
Beiträge vom vorherigen Thema anzeigen:     
Gehe zu:  
Alle Zeiten sind GMT + 1 Stunde
Neues Thema eröffnen   Neue Antwort erstellen
Vorheriges Thema anzeigen Druckerfreundliche Version Einloggen, um private Nachrichten zu lesen Nächstes Thema anzeigen
PNphpBB2 © 2003-2007 
 
Deutsch | English
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you. Our web server is running on Kanotix64-2006.