Gossamer Forum
Home : General : Perl Programming :

Need If-then Code To check if html or Text detail display

Quote Reply
Need If-then Code To check if html or Text detail display
I wanted to use line breaks ('paragraphs') in my detailed view, somewhere I found a thread that told me to do this: in site_html_detailed (in either site_html.pl or site_html_templates.pl depending on whether you are using templates or not), add:
$rec{'Details'} =~ s/\n/<br>/g;
to change all line feeds to html line break tags.
This works fine BUT... I want best of both worlds. I need a code line to check if we find a <br> or <BR> or <P> or <p> then we do not do the above code and proceed as usuall. Could anyone tell me what that code might look like.
Thanks
Tim Ryan

Quote Reply
Re: Need If-then Code To check if html or Text detail display In reply to
It would seem to me that, if you don't tell the script to do anything with the <p> or <P> or <br> or <BR>, it would proceed as normal. Scripts will only do what you tell them to do. All you are doing with the code so far is replacing a linefeed with a <br> tag. Nothing else is changed.
Quote Reply
Re: Need If-then Code To check if html or Text detail display In reply to
Let me clarify the original post. This code is for add.cgi or somewhere there-abouts. I want to be able to check if someone submits their resource to determine when they are submitting HTML code or if they are sumitting plain text.(I am using resource templates for what that is worth).

The reason I need to do this is because I am doing a few mods that will require me to know this. I know I could put a radio button field in but I do not want to do that. I want full control of knowing what they are submitting (especially if it is an automated submit).

Sorry, I should have clarified my original post better.

Also, for those who stumble upon this thread, it turns out I might have solved what I need here (partially) with some suggestions on my thread at:
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/002462.html

However, there still might be a better code way to do this.

TimRyan


[This message has been edited by timryan (edited July 30, 1999).]