Gossamer Forum
Home : General : Perl Programming :

TextArea

Quote Reply
TextArea
I am a using a little template editor I am using for my site, and one of the templates is really big and for some reason it gets cut off after a hwile and then prints the html on the page and not in the textarea box.

Anyone know the max length for it, and anyway that big file will be able to stay in the box?

-------------
Jeremy
Quote Reply
Re: TextArea In reply to
I think you will find it is just a limit in both IE and Netscape. Not quite sure why there is a limit!

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: TextArea In reply to
There is nothing that limits the amount of data that can be in a textarea. It's a browser/OS dependent issue....ie 16bit Windows will be less than 32bit.


Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: TextArea In reply to
Check that your HTML page doesn't have a </textarea> in it. Your editor should escape this (try the new Fileman 2).

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: TextArea In reply to
Thanks for poiting that out Alex, that is the problem..

Anyway to make where it wont escape the main <textarea> with </textarea> in the file your opening? Or am I just not ever going to be able to do that.. I thought I have seen it working before on a similar script that it would escape it and it would print right.

-------------
Jeremy
Quote Reply
Re: TextArea In reply to
Hi,

You basically want to change all < into &lt; and all > into &gt;, and then print your file.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: TextArea In reply to
Are their a way for the script to do that itself when it opens it though? I don't want to go through and edit all the <'s and >'s.

-------------
Jeremy
http://lc.crashinto.com - Crashinto Learning Central
Quote Reply
Re: TextArea In reply to
try using Editplus at www.editplus.com. They have features like 'go to line' 'match brace' replace words'- where it searches for a word you input and replaces it with one you input, etc

Quote Reply
Re: TextArea In reply to
In perl that would be:

$text =~ s/</&lt;/g;
$text =~ s/>/&gt;/g;

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: TextArea In reply to
Thanks Alex...

But that still didn't fix it..

-------------
Jeremy
http://lc.crashinto.com - Crashinto Learning Central
Quote Reply
Re: TextArea In reply to
Ok here is what I got..

use CGI;
$foo = new CGI;
$file = $foo->param('file'); # Gets what file to open...
$file =~ s/</& lt;/g;
$file =~ s/>/& gt;/g;

print "Content-type: text/html", "\n\n";


open(FILE,"$file");
@filecontents = <FILE>;

close(FILE);


print qq|
<HTML>
<body bgcolor="#000000" text="#FFFFFF" style="margin:0px">
<table border=0 height="100%" width="100%" cellpadding=0 cellspacing=0>
<tr valign=top>
<TD BGCOLOR="#D3d3d3" WIDTH="35%">
 
</td><td width="65%" align=center valign=middle>
<form name="save" ACTION="filesaved.cgi">
You are editing: <INPUT type=text name="file" value="$file" READONLY size=50>
<TEXTAREA NAME="newfile" COLS="55" ROWS=37>
|;

foreach $line(@filecontents) { print "$line"; }

print qq|
</TEXTAREA>

<INPUT TYPE=submit value="Save the File">
</form>
</td></tr></table>
</body>
</html>
|;
Now would I place that code that you gave me where I have it now, inside the open FILE, or inside the foreach loop that prints the html?

-------------
Jeremy
http://lc.crashinto.com - Crashinto Learning Central
Quote Reply
Re: TextArea In reply to
You may like to try:

Code:
use CGI;
$foo = new CGI;
$file = $foo->param('file'); # Gets what file to open...

print header;
print qq|
<html>
<head>
</head>
<body bgcolor="#000000" text="#FFFFFF" style="margin:0px">
<table border=0 height="100%" width="100%" cellpadding=0 cellspacing=0>
<tr valign=top>
<TD BGCOLOR="#D3d3d3" WIDTH="35%"></td>
<td width="65%" align=center valign=middle>
<form name="save" ACTION="filesaved.cgi">
You are editing:
<INPUT type=text name="file" value="$file" READONLY size=50>
<TEXTAREA NAME="newfile" COLS="55" ROWS=37>
|;
open(FILE, "<$file");
while (<FILE>) {
s/</&amplt;/g;
s/>/&ampgt;/g;
print;
}
close(FILE);
print qq|
</TEXTAREA>
<INPUT TYPE=submit value="Save the File">
</form>
</td>
</tr>
</table>
</body>
</html>
|;
You may want to check the validity of $file also so hackers can't do any nasty stuff.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: TextArea In reply to
Thanks Paul, That worked.

-------------
Jeremy
http://lc.crashinto.com - Crashinto Learning Central