Hi Wretha,
Here's some ideas:
<?php
$title = "Hello <123> #*&%$£! to, the, it, and, or, with, too, also, a, if,
Wretha";
// all lowercase
$filename=strtolower($title);
// uncomment next 2 lines to see what it does
// $remove = array('to','the','it','and','or','with','too','also','an','if');
// $filename=str_replace($remove,"",$filename);
// accept only a to z + spcs
$filename=preg_replace("/[^a-z ]/","",$filename);
// 1 or more spcs to underscore
$filename=preg_replace("/[ ]+/ ","_",$filename);
// cut filename to length
$filename=substr($filename,0,20);
// trim and add file extension
$filename=trim($filename).".html";
echo $filename;
?>
To get rid of small words, I'd probably look for words <= 3 chars and delete
them.
Maybe someone has a better solution?
Bob E.
----- Original Message -----
From: "W. Smith" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 05, 2006 5:39 AM
Subject: [php-list] Re: Request for PHP code adjustment
> Hello Bob! Thanks so much, that worked, you are an angel, and thanks
> for the last tip, I fixed that as well, now I just need to remove the
> characters that don't translate well into HTML and remove the extra
> words that aren't necessary in the titles.
>
> [EMAIL PROTECTED]&*()+=\/`{}[]:;"'?<>
>
>
> to, the, it, and, or, with, too, also, an, if
>
> How and where would I put that in?
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/