Firefox PHP

Icon and icon when >Xposts

Posted by Anonymous User 
Anonymous User
Icon and icon when >Xposts
February 28, 2003 04:53PM
Hi, i did a little change in include/threads.php (l.82), i have added an icon before the subjects :

echo ' <td class="PhorumListRow" '.$color.'> <img src="image.gif"><FONT color="'.$fcolor.'"> '.$img.' '.$t_subject." </font>";


Now i would like that icon to be different when there are more than 30 (for example) replies.
I tried to modify the line like this but it doesn't work :

echo ' <td class="PhorumListRow" '.$color.'> <img src="<? if ($t_count>30) { echo 'image1.gif'; }else{ echo 'image2.gif'; } ?>"><FONT color="'.$fcolor.'"> '.$img.' '.$t_subject." </font>";


Could somebody show me how to do ?

PS : this modd would be nearly the same as the one of Matt (forum graphics) without caring about new posts.

Anonymous User
Re: Icon and icon when &amp;gt;Xposts
March 01, 2003 06:19AM
Ok it's done (thanks to ts77 :)
I let the file.txt if somebody is interessed (in english and in french)
Bye

Anonymous User
Re: Icon and icon when >Xposts
March 01, 2003 06:20AM
the attachment didn't work ...
So here is the contain of the file :




*** PHORUM V 3.4.1 ***


English :
This little mod add an icon of your choice just before the subjects in list.php (plane view).
The icon is changing when the topic get at least 30 (or the number of your choice) replies.
You just need to change some lines of include/threads.php

Français :
Ce petit mod ajoute une icone de votre choix juste devant les sujets dans le fichier list.php (en vue plane uniquement).
L'icone change lorsque le topic atteint un nombre donné de réponses.
Il requiert de modifier quelques lignes de include/threads.php



// ********* BEGINNING OF include/treads.php *********


<?php
if ( !defined( "_COMMON_PHP" ) ) return;

settype($read, "boolean");

if (!isset($$phcollapse)) {
$$phcollapse=0;
}
?>
<table class="PhorumListTable" width="<?php echo $ForumTableWidth; ?>" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="240" ><FONT color="<?php echo $ForumTableHeaderFontColor; ?>">&nbsp;<?php echo $lTopics;?><img src="images/trans.gif" border=0 width=1 height=24 align="absmiddle"></font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="140" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lAuthor;?>&nbsp;</font></td>
<?php if ( empty($read) && $$phcollapse != 0) { ?>
<td class="PhorumListHeader" align="center" <?php echo bgcolor($ForumTableHeaderColor); ?> width="50" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lReplies;?>&nbsp;</font></td>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="110" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lLatest;?></font></td>
<?php }else{ ?>
<td class="PhorumListHeader" <?php echo bgcolor($ForumTableHeaderColor); ?> width="110" nowrap="nowrap"><FONT color="<?php echo $ForumTableHeaderFontColor; ?>"><?php echo $lDate;?></font></td>
<?php } ?>
</tr>
<?php
$x=0;
$loc=0;
@reset($headers);
$message = @current($headers);
if(empty($read) && !empty($message)){
$trec=$threads[$message["thread"]];
}

while (is_array($message)){
if(($x%2)==0){
$bgcolor=$ForumTableBodyColor1;
$fcolor=$ForumTableBodyFontColor1;
}
else{
$bgcolor=$ForumTableBodyColor2;
$fcolor=$ForumTableBodyFontColor2;
}
$t_id=$message["id"];
$t_thread=$message["thread"];
$t_subject=chop($message["subject"]);
if(!empty($users[$message["userid"]])){
$t_author=$users[$message["userid"]]["username"];
if(isset($moderators[$message["userid"]])){
$t_author="<font color='#ff8800'>$t_author</font>";
}
} else {
$t_author=chop($message["author"]);
}
$t_datestamp = date_format($message["datestamp"]);

if( ($$phcollapse != 0) && (empty($read)) ){
$t_latest=date_format($trec["latest"]);
$t_maxid=$trec["maxid"];
}
$message = next($headers);

if($t_thread!=$t_id){
$img = '<img src="images/l.gif" border=0 width=12 align="top">';
if(is_array($message)){
if($t_thread==$message["thread"]){
$img='<img src="images/t.gif" border=0 width=12 align="top">';
}
}
}
else{
$img="<img src=\"images/trans.gif\" border=0 width=1 height=21 align=\"absmiddle\">";
$loc=0;
}

if($read==true && $id==$t_id){
$t_subject = "<strong>$t_subject</strong>";
$t_author = "<strong>$t_author</strong>";
$t_datestamp = "<strong>$t_datestamp</strong>";
}
else{
$t_subject="<a href=\"$read_page.$ext?f=$num&i=$t_id&t=$t_thread$GetVars\">$t_subject</a>";
}

// HERE ARE THE NEW LINES

$t_count=$trec["tcount"];
if ($t_count>30) {
$act_image="image2.gif"; // make sure you upload image2.gif in your phorum folder
}
else{
$act_image="image1.gif"; // make sure you upload image1.gif in your phorum folder
}

$color=bgcolor($bgcolor);
echo "<tr>\n";
echo ' <td class="PhorumListRow" '.$color.'>&nbsp;<img src="'.$act_image.'"><FONT color="'.$fcolor.'"> '.$img.' '.$t_subject." </font>";

// END OF THE LITTLE MOD

if($UseCookies){
$isnew=false;
if($$phcollapse != 0 && empty($read)){
// collapsed code
if($use_haveread){
if ($old_message<$t_maxid) {
if(!in_array($t_maxid, $haveread)) {
$isnew=true;
}
}
}
elseif($old_message<$t_maxid){
$isnew=true;
}
} else {
// expanded code
if ($use_haveread) {
if ($old_message<$t_id) {
if(!in_array($t_id, $haveread)) {
$isnew=true;
}
}
} elseif ($old_message<$t_id) {
$isnew=true;
}
}
if($isnew){
echo "<font class=\"PhorumNewFlag\">".$lNew."</font>";
}
}

echo "</td>\n";
echo ' <td class="PhorumListRow2" width="140" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_author.'&nbsp;</font></td>'."\n";
if( $$phcollapse != 0 && empty($read) ){
$t_count=$trec["tcount"]-1;
if(!empty($message)) $trec=$threads[$message["thread"]];
echo ' <td class="PhorumListRow2" align="center" width="50" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_count."&nbsp;</font></td>\n";
echo ' <td class="PhorumListRow2" width="110" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_latest."&nbsp;</font></td>\n";
}
else{
echo ' <td class="PhorumListRow2" width="110" '.$color.' nowrap="nowrap"><FONT color="'.$fcolor.'">'.$t_datestamp.'&nbsp;</font></td>'."\n";
}
echo "</tr>\n";
$x++;
$loc++;
} // end while
?>
</table>


// ******** END OF include/treads.php **********



Post Edited (03-01-03 05:23)
Sorry, you do not have permission to post/reply in this forum.