ziedinjsh Posted November 12, 2011 Report Share Posted November 12, 2011 (edited) sveiki! īsti nesaprotu kas pa problēmu. Izmantoju šādu teksta saīsinātāju: function cutText($string, $limit, $break=".", $pad="..."){ if(strlen($string) <= $limit) return $string; if(false !== ($breakpoint = strpos($string, $break, $limit))) { if($breakpoint < strlen($string) - 1) { $string = substr($string, 0, $breakpoint) . $pad; } } return $string; } teksts saīsinās.. it kā viss notiek, bet pārējie div kur tiek izvadīta informācija ir ielīduši pirmajā div, bet kad neizmantoju teksta saīsinātāju viss ir savās vietās! datu izvadīšana if($page==""){ $news = mysql_query("SELECT * FROM news ORDER BY id DESC")or die(mysql_error()); while($data = mysql_fetch_array($news)){ $news_text = cutText($data['news'],750); if(empty($data['image'])){ $photo = "<img src='misc/no-image.jpg' class='image'>"; }else{ $photo = "<img src='images/small/".$data['image']."' class='image'>"; } echo " <div class='news'> <div class='newstext'> ".$photo."<span class='title'>".$data['title']."<span class='date'>".$data['date']."</span></span><br><span class='content'>".$news_text." <a href='index.php?page=read&id=".$data['id']."'>Read more</a></span><br> <span class=''>".$data['views']." views</span> <div class='fix'></div> </div> </div> <div class='shadow'></div> "; } Edited November 12, 2011 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
nemakuphp Posted November 12, 2011 Report Share Posted November 12, 2011 Tev iekš $data['news'] gadijumā nav HTML? Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted November 12, 2011 Author Report Share Posted November 12, 2011 (edited) nu jā texta editora tagi. Apskatījos, beigās bija div noslēdzosāis tags.. izdzēsu, bet nu izmaiņas nav nekādas! Edited November 12, 2011 by ziedinjsh Quote Link to comment Share on other sites More sharing options...
briedis Posted November 12, 2011 Report Share Posted November 12, 2011 lieto strip_tags 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.