| @@ -162,13 +162,15 @@ function one_random_record ($core){ | |||
| function ten_random_titles ($core){ | |||
| for ($x=0; $x <= 9; $x++) { | |||
| $x = 0; | |||
| while ($x <= 9) { | |||
| $random = get_random_record($core); | |||
| foreach($random as $id => $content){ | |||
| // Search for the title in the content element and display it | |||
| if (preg_match('/Title.*\n(.*)\n/', $content, $title)){ | |||
| $output[$x] = array($id=>$title[1]); | |||
| ++$x; | |||
| } | |||
| } | |||
| } | |||
| @@ -177,16 +179,19 @@ function ten_random_titles ($core){ | |||
| function ten_random_abstracts ($core){ | |||
| for ($x=0; $x <= 9; $x++) { | |||
| $x = 0; | |||
| while ($x <= 9) { | |||
| $random = get_random_record($core); | |||
| foreach($random as $id => $content){ | |||
| // Search for the abstract in the content element and display it | |||
| if (preg_match('/Abstract.*\n(.*)\n/', $content, $abstract)){ | |||
| $output[$x] = array($id=>$abstract[1]); | |||
| ++$x; | |||
| } | |||
| elseif (preg_match('/\(.\) \\n\\n(.*)\\n/', $content, $abstract)) { | |||
| $output[$x] = array($id=>$abstract[1]); | |||
| ++$x; | |||
| } | |||
| } | |||
| } | |||
| @@ -196,7 +201,7 @@ function ten_random_abstracts ($core){ | |||
| function ten_random_doc_refs ($core){ | |||
| $x = 0; | |||
| while ($x < 9) { | |||
| while ($x <= 9) { | |||
| $random = get_random_record($core); | |||
| foreach($random as $id => $content){ | |||