<?php 
$result4 = $mysqli->query("SELECT insert_id, page, name, title, text, image FROM categories WHERE promote LIKE '%1%' AND lang_id=$lang ORDER BY priority, parent");
while($row = $result4->fetch_array()) {	
$icid=$row['insert_id'];
$catpage=$row['page'];
$catname=$row['name'];
$catdesc=$row['title'];
$cimage=$row['image'];
if (!$catdesc) { 
$catdesc=$catname;
}
$catt1=$row['text'];
$catt = mb_substr(strip_tags($catt1), 0, 300, 'UTF-8');
$photopath="categories/";
?>
<div class="boxcat"><div class="boxincat">
<div class="boximage-cat colorlight"><a href="<?php echo $catpage ?>"><img src="<?php echo $codepath ?>includes/image.php?image=<?php echo $imagepath.$photopath ?><?php echo $icid ?>.jpg&amp;nwidth=400" class="bordercolor1 img-icat" alt="<?php echo $catname ?>" title="<?php echo $catdesc ?>"></a></div>
<div class="boxcattitles"><?php echo $iconcat ?> <a href="<?php echo $catpage ?>" class="color1"><?php echo $catname ?></a></div>
<div class="boxcattext color1h"><?php echo $catt ?><?php if ($catt1!=$catt) { echo '...'; }?></div>
</div></div>  
<?php }?><div class="cleared"></div>