php-windows Digest 30 Mar 2003 03:03:55 -0000 Issue 1659
Topics (messages 19184 through 19187):
Re: Tables (might be OT)
19184 by: Kobus Myburgh
19185 by: Ben O'Neill
19186 by: Paul Roberts
upload question
19187 by: Anthony Ritter
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I have done a similar thing that worked reasonably well in Visual Basic (however,
included is a PHP snippet which might do the trick - I am not a PHP pro).
write a small PHP function to select only a part of the string, say the first 15
characters, and append "..." to the string, for example,
thisisoneveryveryveryveryverylongword!!!!
will become:
thisisoneveryver...
This is standard PHP string manipulation, which might look something like this:
function myTruncate ($verylongstring, $length) {
if (strlen($verylongstring) > $length) {
$shorterstring = substr($verylongstring,0,$length-1) . "...";
}
else
$shorterstring = $verylongstring;
}
return $shorterstring;
}
(This is untested, but should work...).
You can then call this in your table cell as follows:
<td>print myTruncate("thisisoneveryveryveryveryverylongword!!!!", 15);</td>
Hope this helps :)
Regards,
Kobus
>>> "Bobo Wieland" <[EMAIL PROTECTED]> 3/29/2003 12:37:02 PM >>>
When using dynamic content, like PHP interacting with MySQL it is easier to
use tables then anything else. But tables will get you into trouble! If
someone enters a really long word the tablecell will expand so that the
hwole word will be shown.
Is there some way I can prevent this? With html, php or css? I've tried
style='overflow:hidden' but it didn't work...
.bobo
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi, just one correction to Kobus' code:
function myTruncate ($verylongstring, $length) {
if (strlen($verylongstring) > $length) {
$shorterstring = substr($verylongstring,0,$length-1) . "...";
} else {
$shorterstring = $verylongstring;
}
return $shorterstring;
}
He was missing a "{", otherwise it was fine.
--
Ben O'Neill
"Kobus Myburgh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi,
I have done a similar thing that worked reasonably well in Visual Basic
(however, included is a PHP snippet which might do the trick - I am not a
PHP pro).
write a small PHP function to select only a part of the string, say the
first 15 characters, and append "..." to the string, for example,
thisisoneveryveryveryveryverylongword!!!!
will become:
thisisoneveryver...
This is standard PHP string manipulation, which might look something like
this:
function myTruncate ($verylongstring, $length) {
if (strlen($verylongstring) > $length) {
$shorterstring = substr($verylongstring,0,$length-1) . "...";
}
else
$shorterstring = $verylongstring;
}
return $shorterstring;
}
(This is untested, but should work...).
You can then call this in your table cell as follows:
<td>print myTruncate("thisisoneveryveryveryveryverylongword!!!!", 15);</td>
Hope this helps :)
Regards,
Kobus
>>> "Bobo Wieland" <[EMAIL PROTECTED]> 3/29/2003 12:37:02 PM >>>
When using dynamic content, like PHP interacting with MySQL it is easier to
use tables then anything else. But tables will get you into trouble! If
someone enters a really long word the tablecell will expand so that the
hwole word will be shown.
Is there some way I can prevent this? With html, php or css? I've tried
style='overflow:hidden' but it didn't work...
.bobo
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
you could use css word-wrap attribute to control this.
i.e. word-wrap: break-word;
Best Wishes
Paul Roberts
mail at paul-roberts dot com
++++++++++++++++++++++++
----- Original Message -----
From: "Bobo Wieland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 10:37 AM
Subject: [PHP-WIN] Tables (might be OT)
When using dynamic content, like PHP interacting with MySQL it is easier to
use tables then anything else. But tables will get you into trouble! If
someone enters a really long word the tablecell will expand so that the
hwole word will be shown.
Is there some way I can prevent this? With html, php or css? I've tried
style='overflow:hidden' but it didn't work...
.bobo
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Greetings all,
Using PHP 4.1.1 / Apache Server / MS Win 98 / IE 5.5
The following script is from Julie Meloni's book PHP Fast and Easy on page
170-174.
The first part is an html form in which the user browses and chooses a file
to be upoloaded to the server.
The script works fine in that when I chose a file and hit submit it, the
file ends up in:
C:\apache\htdocs
However, in the book, in the last illustration, she explains:
"Just to be sure, use the File/Open Page menu item in your _browser_ to
navigate through your filesystem and find the file that you just uploaded."
The illustration shows the .jpg file _within_ the browser screen on the
upper left hand side.
When I follow those steps and hit file / open, my paint program takes over
and opens the uploaded .jpg file and the browser interface of MS IE 5.5 is
gone.
Any advice would be appreciated.
Thank you.
Tony Ritter
.......................................................................
// html form
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
<p>
File to upload:
<input type="file" name="thefile" size="30">
</p>
<p>
<input type="submit" name="submit" value="Upload File">
</p>
</form>
</body>
</html>
// .php script called upload.php
<?
if ($thefile != "")
{
copy("$thefile","C:\\apache\\htdocs\\$thefile_name")or die("Could not copy
the file.");
}
else
{
echo "No file to upload.";
}
?>
<html>
<head>
</head>
<body>
<p>
You sent:
<? echo "$thefile_name"; ?>, a <? echo "$thefile_size"; ?> byte file with a
mime type of <? echo "$thefile_type" ; ?>.
</p>
</body>
</html>
--- End Message ---