Lancom Posted July 21, 2010 Report Share Posted July 21, 2010 (edited) help video script name shorter nestrada. kr4 man negrib samazinaties video nosaukums, un vel neuzrada video nosaukumu. <?php if($logged_in) { ?> <a href="/videos/" class="menu"><b>Видео</b></a> <div class="dotted_hr"> </div> <br /> <?php define("INCLUDES_DIR","includes/"); include INCLUDES_DIR . "config.php"; function pagination($count,$perpage) { echo "<div class=\"pagination\">\r"; $between = 5; $pages = ceil($count/$perpage); if($pages<2) { echo ""; } $page = (empty($_GET['p']) || $_GET['p']<2) ? 1 : $_GET['p']; $first = $page >= $between+1 ? $page-$between : 1; $last = $page <= $pages-$between ? $page+$between : $pages; if($page>1) { $p.= sprintf('<a href="/videos/?p=1">«</a><a href="?p=%d">‹</a>', $page-1); } for($i=$first;$i<$last;$i++) { $p.= sprintf('<span%s><a href="/videos/?p=%d">%d</a></span>', $page==$i ? ' class="current"' : '' , $i, $i); } if($page<$pages) { $p.= sprintf('<a href="?p=%d">›</a><a href="?p=%d">»</a>', $page+1, $pages); } $p.= "\r</div>"; echo $p; } $perpage = 16; $_LIMIT = (!empty($_GET['p']) && $_GET['p']>1)?($_GET['p']*$perpage)-$perpage:0; $_LIMIT.=", ".$perpage; $result = mysql_query("SELECT * FROM ".DB_PREFIX."videos ORDER BY id DESC LIMIT ".$_LIMIT."") or die(mysql_error()); $count = mysql_num_rows(mysql_query("SELECT * FROM ".DB_PREFIX."videos")); while($row = mysql_fetch_array($result)) { $rows = mysql_fetch_array(mysql_query("SELECT * FROM ".DB_PREFIX."videos WHERE id = ".$row['id']."")); printf(" <div class=\"video_container\"> <table class=\"video_box1\"> <tr> <td><a href=\"/watch/?id=".$row['id']."\"><img src=\"http://i1.ytimg.com/vi/".$row['embed']."/default.jpg\" alt=\"".$row['name']."\" style=\"120px; height: 70px;\" /></a> <td valign=\"top\">» <a href=\"video/watch/?id=".$row['id']."\"><b>".(strlen($row['name'], 0,10))."</b></a> <br />» <b>Просмотров: (1)</b> <br />» <b>Рейтинг:</b> </td> </tr> </table> </div> \r"); } pagination($count,$perpage); mysql_free_result($result); } else { echo "Пожалуйста залогиньтесь, или регистрируйтесь."; } ?> Edited July 21, 2010 by Lancom Quote Link to comment Share on other sites More sharing options...
101111 Posted July 21, 2010 Report Share Posted July 21, 2010 (edited) Kur problēma? Mēģini saīsināt nosaukumu šādā veidā? (strlen($row['name'], 0,10)) Šādi var saīsināt tekstu: $txt = (mb_strlen($txt, "UTF-8") > 10) ? mb_substr($txt, 0, 10, "UTF-8") . "..." : $txt; echo $txt; Edited July 21, 2010 by 101111 Quote Link to comment Share on other sites More sharing options...
Lancom Posted July 21, 2010 Author Report Share Posted July 21, 2010 (edited) izdariju caur funkciju saisinat bet vidio kadi kvadrati uzrada BOM ELEMENTS nezinu ka vini var izdzest! Edited July 21, 2010 by Lancom Quote Link to comment Share on other sites More sharing options...
waplet Posted July 21, 2010 Report Share Posted July 21, 2010 mb_substr Quote Link to comment Share on other sites More sharing options...
Lancom Posted July 21, 2010 Author Report Share Posted July 21, 2010 pats videos.php fails saglabats utf-8 formata lai uzraditu krievu burtus un utt. tika maisa sitais visas video nosaukumus Quote Link to comment Share on other sites More sharing options...
Lancom Posted July 23, 2010 Author Report Share Posted July 23, 2010 sorry for double post... VAR Topiku close. izlaboju so gluku ar sa skripta polidzibu ".(mb_substr($row['name'], 0,15, 'utf-8'))." Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.