--- a/documents/template.inc.php +++ b/documents/template.inc.php @@ -21,7 +21,7 @@ <!-- Mobile viewport optimized: h5bp.com/viewport --> <meta name="viewport" content="width=device-width"> - +<link rel="alternate" type="application/rss+xml" title="Latest Disclosure Log Entries" href="rss.xml.php" /> <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons --> <meta name="google-site-verification" content="jkknX5g2FCpQvrW030b1Nq2hyoa6mb3EDiA7kCoHNj8" /> @@ -89,7 +89,7 @@ <hr> <footer> - <p>© Company 2012</p> + <p>Not affiliated with or endorsed by any government agency.</p> </footer> <script type="text/javascript"> @@ -128,10 +128,25 @@ </html> <?php } - +function truncate($string, $length, $stopanywhere=false) { + //truncates a string to a certain char length, stopping on a word if not specified otherwise. + if (strlen($string) > $length) { + //limit hit! + $string = substr($string,0,($length -3)); + if ($stopanywhere) { + //stop anywhere + $string .= '...'; + } else{ + //stop on a word. + $string = substr($string,0,strrpos($string,' ')).'...'; + } + } + return $string; +} function displayLogEntry($row, $idtoname) { $result = ""; - $result .= "<div><h2>".$row->value->date.": ".$row->value->title." (".$idtoname[$row->value->agencyID].")</h2> <p>".str_replace("\n","<br>",$row->value->description); + $result .= "<div><h2>".$row->value->date.": ".truncate($row->value->title, 80)." (".$idtoname[$row->value->agencyID].")</h2>"; + echo "<p> Title".$row->value->title."<br/>".str_replace("\n","<br>",$row->value->description); if (isset($row->value->notes)) { $result .= " <br>Note: ".$row->value->notes; }