Jump to content

Announcements integration


extalion

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated