Location: PHPKode > scripts > Define Word > define-word/defineText.php
<?php
include_once("DefineWord.class.php");
$ClosingIndentTag='</transe>';
$txt = "This is a sample <transe>text</transe> , you can put <transe>anything</transe> you'd like to define within
        the special tags and use this APP as an on the fly definder for your web applications<br> hoover over the blue <transe>link</transe> in order to <transe>learn</transe> about their definitions";
	
$arrayTxt = explode(" ",$txt);


echo "before ...:<br>";
echo $txt;
echo "<hr>";
echo "<br>after...:<br>";
array_walk($arrayTxt,'getDefinition');
echo unexplode($arrayTxt,' ');



function getDefinition(&$value) 
{ 
  global $ClosingIndentTag;
  if (strpos($value,$ClosingIndentTag)>0) {
  $wordToDefine = strip_tags($value);
  $myDict = new DefineWord($wordToDefine,"dict.org",1,"short");
  $definition = $myDict->definitionsArray[0]; 
  $value = "<a href='#' title='$definition' >$wordToDefine</a>"; }
}


function unexplode($arrayInput,$delimiter) {
$originalTXT = '';
foreach ($arrayInput as $key=>$value)  
        $originalTXT .= $value.$delimiter;
return $originalTXT; 

}



			
?>




Return current item: Define Word