extalion Posted May 28, 2013 Share Posted May 28, 2013 Hello i want to integrate to the files homepage.tpl dat code <?php$x=1; function truncate($text) { $text = substr($text,0,60); $text = substr($text,0,strrpos($text,' ')); $text = $text.'...'; return $text; } function formatdate($date) { $month = substr ($date, 5, 2); $day = substr ($date, 8, 2); switch($month){ case 1: $month = 'JAN'; break; case 2: $month = 'FÉV'; break; case 3: $month = 'MAR'; break; case 4: $month = 'AVR'; break; case 5: $month = 'MAI'; break; case 6: $month = 'JUN'; break; case 7: $month = 'JUL'; break; case 8: $month = 'AOÛ'; break; case 9: $month = 'SEP'; break; case 10: $month = 'OCT'; break; case 11: $month = 'NOV'; break; case 12: $month = 'DÉC'; break; default: $month = 'Erreur'; } return '<p class="date"><span class="day">'.$day.'</span><br /><span class="month">'.$month.'</span></p>'; } $limit = 2; include("dbconnect.php"); include("includes/functions.php"); $result = mysql_query("SELECT * FROM tblannouncements WHERE published='on' ORDER BY id DESC LIMIT ".$limit); while($data = mysql_fetch_array ($result)) { $id = $data['id']; $date = $data['date']; $title = $data['title']; $announcement = truncate($data['announcement']); $date = formatdate($date); echo'<li class="right">'.$date.'<h4>'.$title.'</h4><p>'.$announcement.'<br /><a href="announcements.php?id='.$id.'">Lire la suite</a></p></li>'; } ?> it for moding the see result of announcement to fit with the design of my site thx you for your help 0 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.