This topic is locked

Modifying data in field prior to listing

12/17/2008 10:38:36 PM
PHPRunner General questions
rsawchuk author

In one of our applications, we have data that we want to strip before displaying in a list or report, e.g., "Medical Terminology Quiz I #22929747-1". We want to remove the numerical id from this field as it is unnecessary.
We have been supplied a function to strip this extra data:

//To remove Quiz ID from the Quiz Name

function formatQuizTitle($quizTitle){

$withoutTrailingNumber = preg_replace('/#[0-9]+-[0-9]+/','',$quizTitle);

return $withoutTrailingNumber;

}



I have tried several different ways to get this to work but have been unsuccessful. Where is this PHP code inserted ... in the Visual Editor, or in the Events section? Also, what command(s)/statements, are required to process the function?
Thanks,
Russ

J
Jane 12/18/2008

Hi,
use custom format on the "View as" settings dialog on theVisual Editor tab for this purpose.

Here is a sample:

$value = preg_replace('/#[0-9]+-[0-9]+/','',$value);

rsawchuk author 12/18/2008

Thanks Jane, works perfectly! I love it when there is a simple solution to a confusing problem (confusing for me that is)! Also thanks for such prompt responses and great support.
Russ