News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Post recenti

Started by -Volpe™., April 17, 2014, 03:50:18 PM

Previous topic - Next topic

-Volpe™.

.

emanuele

mmm...
Non senza modificare il codice.
In teoria potrebbe essere sufficiente modificare una query (forse), non son sicuro della conseguenze.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

-Volpe™.

#2
.

emanuele

Quote from: -Volpe™. on April 17, 2014, 03:50:18 PM
Ed inoltre, c'è un modo per far comparire solo l'ultima risposta?
In Subs-Recent.php:
Code (cerca) Select

$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE m.id_msg >= {int:likely_max_msg}' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY m.id_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
)
);

Code (rimpiazza con) Select

$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}messages AS m ON (t.id_last_msg = m.id_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE 1=1' .
(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $latestPostOptions['number_posts'],
array(
'likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']),
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
)
);

testato velocemente, ma dovrebbe funzionare (e tecnicamente è anche moooooooooolto più veloce della query originale. :P

Quote from: -Volpe™. on April 17, 2014, 03:50:18 PM
Volevo chiedervi, c'è un modo per scegliere le sezioni da mostrare nella lista dei post recenti? (Quella in basso)
[/code]
Nel codice sopra puoi rimpiazzare 1=1 con qualcosa tipo:
b.id_board IN (1, 2, 3)
dove 1, 2 e 3 sono gli id delle board.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

O_o

Ma solo qui o anche da altre parti?
Il "Re:" è salvato nell'oggetto del topic, quindi se accade solo in questo caso può essere un problema (che a dire il vero non saprei quale sia), ma se accade ovunque è decisamente un altro.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

-Volpe™.

#5
.

emanuele

Mi sa che non mi son spiegato bene: intendevo se il problema si presenta solo lì o ovunque.
Ad ogni modo ho trovato un link al tuo forum ed ho visto che il problema si presenta ovunque, quindi il problema è altrove.

Apri index.italian.php (/Themes/default/languages) e cerca:
$txt['response_prefix']
Dovrebbe apparire:
$txt['response_prefix'] = 'Re: ';
ma probabilmente a te manca quello spazio finale, aggiungilo.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

-Volpe™.

#7
.

emanuele

Non cambia nulla perché ormai i messaggi sono stati creati e salvati nel database con il "Re:" senza spazio.
Dalle prossime risposte lo spazio apparirà.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

-Volpe™.

#9
.

emanuele

Ehhh... devi convertire quel pezzo in una tabella...
Il blocco è in BoardIndex.template.php e parte da:
// This is the "Recent Posts" bar.
in giù per una ventina di righe...

Meh, probabilmente copiare funziona allo stesso modo:
Code (cerca) Select
elseif (!empty($context['latest_posts']))
{
echo '
<dl id="ic_recentposts" class="middletext">';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<dt><strong>', $post['link'], '</strong> ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</dt>
<dd>', $post['time'], '</dd>';
echo '
</dl>';
}


Code (sostituisci con) Select

echo '
<table id="ic_recentposts">
<tr>
<th class="recentpost">', $txt['message'], '</th>
<th class="recentposter">', $txt['author'], '</th>
<th class="recentboard">', $txt['board'], '</th>
<th class="recenttime">', $txt['date'], '</th>
</tr>';

// Each post in latest_posts has:
// board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
// subject, short_subject (shortened with...), time, link, and href.
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="recentpost"><strong>', $post['link'], '</strong></td>
<td class="recentposter">', $post['poster']['link'], '</td>
<td class="recentboard">', $post['board']['link'], '</td>
<td class="recenttime">', $post['time'], '</td>
</tr>';

echo '
</table>';



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

emanuele

Dove c'è:
<table id="ic_recentposts">
prova con:
<table width="100%" id="ic_recentposts">


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

-Volpe™.


Advertisement: