Page 1 of 2

[RELEASED] Show last topic titles with icon topic

PostPosted: Mon Apr 21, 2008 11:06 am
by Admin
---------------------------------------------
First Post only(new)
It's a new variant - here

---------------------------------------------
MOD Name: Show last topic titles with icon
MOD Version: 0.1
Author: fiorefrank(Admin), contributor by Primy and it is an his idea
MOD Description: Show last topic titles with icons

Works with: phpBB 3.0

Features:

This mod add the last topic titles with icon if there is one and it cut title if too long but make it visible at all if you put the mounse on

Licence: GPL

Installation Level: Easy
Installation Time: some minutes

Demo <-- just look the sample forum on the top

Step 1
Code: Select all
---------[OPEN]-------
includes/function_display.php

---------[FIND]---------
$last_post_subject = $row['forum_last_post_subject'];
---------[AFTER,ADD] --------------
$last_post_subject_short=str_split(censor_text($last_post_subject) , 25);
if (strlen($last_post_subject) > 25 ) $last_post_subject_short[0] = $last_post_subject_short[0] . " ...";

---------[FIND]---------
'LAST_POST_SUBJECT'      => censor_text($last_post_subject),
---------[AFTER,ADD] --------------
'LAST_POST_SUBJECT_SHORT'   => $last_post_subject_short[0],
'LAST_TOPIC_ICON_IMG'      => get_icon_id_for_post($row['forum_last_post_id']) ,

---------[FIND]---------
?>
---------[BEFORE,ADD] --------------
// Futuresquare.net mod
function get_icon_id_for_post($forum_post_id)
{ global $db;
$sql = "SELECT icons_url, icon_id FROM " . POSTS_TABLE . " AS p
   LEFT JOIN " . ICONS_TABLE . " AS i ON (i.icons_id = p.icon_id)
   WHERE post_id = '$forum_post_id'" ;
$result = $db->sql_query($sql);
$data = $db->sql_fetchrow($result);
//$db->sql_freeresult($result);
if ($data['icon_id'])
$imm = "<img src=images/icons/" . $data['icons_url'] ." >";
else $imm = "";
return $imm;
}
/////

Step 2
Code: Select all
---------[OPEN]-------
styles/prosilver/template/forumlist_body.html

---------[FIND]---------
{L_POST_BY_AUTHOR}

---------[BEFORE,ADD] --------------
<a href="{forumrow.U_LAST_POST}" title="{forumrow.LAST_POST_SUBJECT}">{forumrow.LAST_TOPIC_ICON_IMG}{forumrow.LAST_POST_SUBJECT_SHORT}</a><br>

Re: [BETA] Enable last topic titles with icon topic

PostPosted: Mon Apr 21, 2008 11:49 pm
by Primy
Sei semplicemente un grande! :D

Re: [BETA] Show last topic titles with icon topic

PostPosted: Sun Jun 01, 2008 2:45 pm
by Primy
Resuscito il topic per rivolgere una richiesta di modifica a questa mod, che credo interesserà tutti. E' possibile fare in modo che l'icona sull'index, non sia quella dell'ultimo post ma bensi quella del primo post dell'ultimo topic?
Mi spiego meglio. Per com'è adesso la mod, se io inserisco un icona nell'oggetto, ma l'utente replica dopo di me senza icona, sull'index sparirà anche la mia. Se invece la query richiama sempre l'icona del primo post, sull'index rimarrà l'immagine fino a che non arriverà un topic più recente.

Se la cosa non è chiara sono a disposizione Frank! ;)

Re: [BETA] Show last topic titles with icon topic

PostPosted: Mon Jun 02, 2008 9:25 pm
by Admin
Chiarissima!!!
Ottima osservazione come sempre ;)
Appena posso la modifico ;)

Re: [RELEASED] Show last topic titles with icon topic

PostPosted: Mon Oct 27, 2008 8:09 pm
by Primy
Ciao Frank!

E' da un pò che non mi faccio vivo su Future (anche se cazzeggio parecchio con l'area arcade :mrgreen: ).

Vorrei chiederti se ci sono novità riguardo questa mod. Io ho buttato giù un paio di query ma niente da fare, non sono riuscito ad ottenere la modifica che ti avevo chiesto. Scusa se ti scoccio!

A prestissimo!

[RELEASED] Show last topic titles with icon - First post

PostPosted: Wed Nov 12, 2008 2:24 am
by Admin
Hi Primy,
This is the Mod :

Step 1
Code: Select all
---------[OPEN]-------
includes/function_display.php

---------[FIND]---------
$last_post_subject = $row['forum_last_post_subject'];
---------[AFTER,ADD] --------------
$last_post_subject_short=str_split(censor_text($last_post_subject) , 25);
if (strlen($last_post_subject) > 25 ) $last_post_subject_short[0] = $last_post_subject_short[0] . " ...";

---------[FIND]---------
'LAST_POST_SUBJECT'      => censor_text($last_post_subject),
---------[AFTER,ADD] --------------
'LAST_POST_SUBJECT_SHORT'   => $last_post_subject_short[0],
'LAST_TOPIC_ICON_IMG'      => get_icon_id_for_post2($row['forum_id']) ,

---------[FIND]---------
?>
---------[BEFORE,ADD] --------------
// Futuresquare.net mod
function get_icon_id_for_post2($forum_id)
{ global $db;

$sql = "SELECT i.icons_url, p.icon_id FROM " . POSTS_TABLE . " AS p
   LEFT JOIN " . TOPICS_TABLE . " AS t ON (t.forum_id = '$forum_id')
   LEFT JOIN " . ICONS_TABLE . " AS i ON (i.icons_id = p.icon_id)
   WHERE p.post_id = t.topic_first_post_id
   ORDER BY t.topic_last_post_time DESC" ;

$result = $db->sql_query($sql);
$data = $db->sql_fetchrow($result);
//$db->sql_freeresult($result);
if ($data['icon_id'])
$imm = "<img src=images/icons/" . $data['icons_url'] ." >";
else $imm = "";
return $imm;
}
/////


Step two is the same

This is a variant of the first mod and it doesn't replace the first one because somebody can find usefull the first one

Demo is here

Re: [RELEASED] Show last topic titles with icon topic

PostPosted: Wed Nov 12, 2008 3:14 am
by Primy
Great!! Thank you very much mate ;) This is a mod which should be a default feature of phpBB!

Thanks!

Re: [RELEASED] Show last topic titles with icon topic

PostPosted: Wed Nov 19, 2008 11:41 am
by Primy
Voglio romperti Frank e fare il pignolo :mrgreen:

Stavo guardando la mod in funzione sul mio sito e mi sono venute in mente due nuove caratteristiche:

La prima è quella di sostituire l'opzione "nessuna (icona), con un icona di default, così in ogni caso sull'index apparirebbe. Sarebbe ancora meglio se l'amministratore potesse scegliere se inserire un icona di default o lasciare le cose così dal modulo in ACP.

La seconda è una semplice funzione che consenta all'amministratore di attivare o disattivare la visualizzazione delle icone sull'index. (Come quella per il viewforum in pratica).

Una volta fatti questi due miglioramenti, la mod sarebbe perfetta! :)

Re: [RELEASED] Show last topic titles with icon topic

PostPosted: Fri Nov 21, 2008 3:23 pm
by Admin
Ciao,
per l'immagine di default basta ke modifichi l'else
Ecco un esempio :
Code: Select all
if ($data['icon_id'])
$imm = "<img src=images/icons/" . $data['icons_url'] ." >";
else $imm = "<img src=images/icons/default_image_name";   //devi modificare questa riga
return $imm;


Per le altre richieste le faccio il prima possibile

Re: [RELEASED] Show last topic titles with icon topic

PostPosted: Fri Dec 19, 2008 9:11 pm
by Prozac88
Ciao scusami volevo sapere come faccio a integrare la mod nella mia skin. Per il primo step non c'è problema..ma nel secondo nel file della mia skin non ci sono quei parametri. Potete aiutarmi?