Hi David,
Currently PT normalise cpitalises the first character of a name field. Is there a way to add an additional normalise function that creates all lower case characters?
Many Thanks
Les :)
Morning David
I'm using the above filter and replaced
return strtolower($text);
with
return ucfirst(strtolower($text));
which works fine for the first sentence. Is it possible to upper case for each new sentence after a full stop with this filter.
Cheers
Chris
Hi Chris,
I think you would need to split the text up into sentences; ucfirst() each sentence and then re-join. Straight forward to do - rather the modify the above here's the code for a new filter "Sentence Case":
/*************************************************/
/* sentenceCase */
/*************************************************/
$filter_names["sentenceCase"] = "Sentence Case";
function filter_sentenceCaseConfigure($filter_data)
{
print "<p>There are no additional configuration parameters for this filter.</p>";
}
function filter_sentenceCaseValidate($filter_data)
{
}
function filter_sentenceCaseExec($filter_data,$text)
{
$text = strtolower($text);
$sentences = explode(".",$text);
foreach($sentences as $k => $v)
{
$v = trim($v);
$sentences[$k] = ucfirst($v);
}
return implode(". ",$sentences).".";
}
Cheers,
David.
--
PriceTapestry.com
Hi Les,
You could quickly add a new filter to provide a strtolower function, and then register this against the product name field. Here's the code - simply paste it into includes/filter.php:
<?php
/*************************************************/
/* strToLower */
/*************************************************/
$filter_names["strToLower"] = "strToLower";
function filter_strToLowerConfigure($filter_data)
{
print "<p>There are no additional configuration parameters for this filter.</p>";
}
function filter_strToLowerValidate($filter_data)
{
}
function filter_strToLowerExec($filter_data,$text)
{
return strtolower($text);
}
?>
Hope this helps!
David.