]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Interface design: shorten too long URLs in the displayed bookmarks
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 18 Apr 2008 10:29:09 +0000 (10:29 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Fri, 18 Apr 2008 10:29:09 +0000 (10:29 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@115 b3834d28-1941-0410-a4f8-b48e95affb8f

functions.inc.php
templates/bookmarks.tpl.php

index 63b789a5758647892b27bdb1c64746807d7aef97..35f0fedaba2170ea185d729ac6cccd9f2e6ff96e 100644 (file)
@@ -92,6 +92,17 @@ function createURL($page = '', $ending = '') {
     return $root . $page .'/'. $ending;
 }
 
+/* Shorten a string like a URL for example by cutting the middle of it */
+function shortenString($string, $maxSize=75) {
+    $output = '';
+    if(strlen($string) > $maxSize) {
+       $output = substr($string, 0, $maxSize/2).'...'.substr($string, -$maxSize/2);
+    } else {
+       $output = $string;
+    }
+    return $output;
+}
+
 function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '', $db = NULL) {
     if(defined('HAS_DIED'))
         die(T_('message_die() was called multiple times.'));
index 556d92e19ac672fcf84576949b3365d7b881b7d3..cc4743cb2b2b2f2456550496c723d52e1b11e3fa 100644 (file)
@@ -171,7 +171,7 @@ window.onload = playerLoad;
         }
         echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
        if(!isset($hash)) {
-           echo '<div class="address">'.$address.'</div>';
+           echo '<div class="address">'.shortenString($address).'</div>';
        }
 
         echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";