php-windows Digest 30 Mar 2003 18:09:37 -0000 Issue 1660
Topics (messages 19188 through 19191):
Re: Tables (might be OT)
19188 by: Neil Smith
19190 by: Bobo Wieland
Re:Subject: upload question
19189 by: Neil Smith
19191 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 ---
Yeah - I use the code below, which I made to limit title length for news
stories. The main advantage is it limits to specified width, but then
*backtracks* to the last whitespace before that in the string, so you get
whole words output followed by '...' :-)
===============================================
// Title width limiter
$titlelimit=50; // Number of characters to allow in a news title subsection
(narrow column)
if (strlen($row->newstitle)<$titlelimit) {
$secvars["news_title"]=htmlspecialchars($row->newstitle);
} else {
$limitedstring=substr($row->newstitle,0,$titlelimit);
$lastspace=strrpos($limitedstring," ");
if ($lastspace===false || $lastspace==$titlelimit) {
// Theres no space to chop string on, or its at the last position : just
limit string to substring
$secvars["news_title"]=htmlspecialchars($limitedstring)." ...";
} else {
// Found a space near end of the string, back off to last space found and
add ellipsis
$secvars["news_title"]=htmlspecialchars(substr($limitedstring,0,$lastspace))." ...";
}
}
// End title width limiter
==================================
Hope that's (obvious !) , Regards,
Neil Smith.
At 03:03 30/03/2003 +0000, you wrote:
Message-Id: <[EMAIL PROTECTED]>
Date: Sat, 29 Mar 2003 13:27:00 +0200
From: "Kobus Myburgh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Subject: Re: [PHP-WIN] Tables (might be OT)
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;
}
--- End Message ---
--- Begin Message ---
Thanks to all of you for helping me.
So far, the css-option - word-wrap:break-word; - is the best solution. But
it's worthless since it doesn't work in Mozilla... To bad... =(
The code (below and in previous mail) is great too, but doesn't work either.
It is only _words_ that are too long that needs to be wraped, the whole
sentence can be longer...
Thanks!
.bobo
----- Original Message -----
From: "Neil Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 3:12 PM
Subject: Re: Re: [PHP-WIN] Tables (might be OT)
> Yeah - I use the code below, which I made to limit title length for news
> stories. The main advantage is it limits to specified width, but then
> *backtracks* to the last whitespace before that in the string, so you get
> whole words output followed by '...' :-)
>
>
> ===============================================
>
> // Title width limiter
>
> $titlelimit=50; // Number of characters to allow in a news title
subsection
> (narrow column)
>
> if (strlen($row->newstitle)<$titlelimit) {
>
$secvars["news_title"]=htmlspecialchars($row->newstitle);
> } else {
>
$limitedstring=substr($row->newstitle,0,$titlelimit);
> $lastspace=strrpos($limitedstring," ");
> if ($lastspace===false ||
$lastspace==$titlelimit) {
> // Theres no space to chop string on, or its at the last position : just
> limit string to substring
>
$secvars["news_title"]=htmlspecialchars($limitedstring)." ...";
> } else {
> // Found a space near end of the string, back off to last space found and
> add ellipsis
>
$secvars["news_title"]=htmlspecialchars(substr($limitedstring,0,$lastspace))
." ...";
> }
> }
> // End title width limiter
>
>
> ==================================
> Hope that's (obvious !) , Regards,
> Neil Smith.
>
> At 03:03 30/03/2003 +0000, you wrote:
> >Message-Id: <[EMAIL PROTECTED]>
> >Date: Sat, 29 Mar 2003 13:27:00 +0200
> >From: "Kobus Myburgh" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Cc: <[EMAIL PROTECTED]>
> >Mime-Version: 1.0
> >Content-Type: text/plain; charset=US-ASCII
> >Subject: Re: [PHP-WIN] Tables (might be OT)
> >
> >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;
> > }
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Err this is fairly basic stuff. Have you tried dragging the file into an
open browser window instead ? Sounds like you need to learn how to set up
windows file associations. I have a 'windows for dummies' book my 5yo kids
use, I can lend you if its any help ?
Cheers,
Neil.
At 03:03 30/03/2003 +0000, Tony wrote:
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
--- End Message ---
--- Begin Message ---
Neil Smith wrote in message:
> Err this is fairly basic stuff. Have you tried dragging the file into an
> open browser window instead ?
.........................
Yes Neil.
I tried that and that works. It shows the image of the .jpg file within the
browser on the upper left hand side.
However in her textbook on PHP she lists the steps which I've posted in the
thread.
The .jpg file opens within the paint program.
The only thing that I can think of is that any .jpg file defaults to the
paint program and overrides the browser.
............................
> Sounds like you need to learn how to set up
> windows file associations. I have a 'windows for dummies' book my 5yo kids
> use, I can lend you if its any help ?
>
> Cheers,
> Neil.
.......................................
Ouch.
Such biting words.
No thanks.
However, if your kids are finished with the textbook - maybe you've got a
library in your town that you'll donate it to?
Kindest regards,
Tony Ritter
--- End Message ---