ciao carlo..
stavo provando queta mod in locale in modo da studiarla e provare a capire se era possibile far visualizzare solo le immagini.. visto che si avvicina molto a quello che intendevo io per la mod che visualizzasse solo le immaigni.. dei topic..
ti colevo chiedere un piacere.. perche non riesco a farla funzionare....
come fose sai io ho installato il postal xl sul mio sito.. .. e quindi invece di mettere il tutto in una pagine esterna.. colevo risucire a metterlo in blocco.. è allora ho provato a fare qualche modifica al codice..
tenendo prima la pagina in formato php in root del phpbb e mettere il codice html in un blocco .. ma questo non ha funzionato.. allora ho provato creare un blocco ( cosa mi pare.. migliore) ma qui mi da un errore! questo
Codice: Seleziona tutto
Fatal error: Cannot redeclare deregister_globals() (previously declared in /membri/lokodb/forum/common.php:32) in /membri/lokodb/forum/common.php on line 94
e la cosa mi insospettisce..
ti mostro più o meno come si struttura la storia dei blocchi..
dunque ce la cartella root/forum/portal/block ( dove di dovrà inserire il codice in php)
io ho provato a creare un file chiamato topocs_list.php fatto cosi
Codice: Seleziona tutto
?php
/*
*
* @package Topic più visti & Ultimi Topic [MOD]
* @author carlino1994
* @website http://www.phpbbitalia.net/
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Configuration
$max_topic = 10;
$forums_id = array(35,36, 37, 38, 66, 101, 53, 54, 59, 60, 55, 58, 56, 57, 161, 162, 169, 173, 174, 175, 168, 185, 186, 163, 164, 61);
$default_image = 'http://lokodb.altervista.org/banner/soloko.png';
$sql = "SELECT p.post_text, p.bbcode_uid, t.* FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t WHERE t.forum_id IN (" . implode(', ', $forums_id) . ") AND p.post_id = t.topic_first_post_id ORDER BY topic_views DESC LIMIT 0," . $max_topic;
$result = $db->sql_query($sql);
$a = $b = 0;
while ($row = $db->sql_fetchrow($result)) {
if ($auth->acl_get('f_read', $row['forum_id'])) {
$a++;
$bbcode_img_to_array = bbcode_img_to_array($row['post_text'], $row['bbcode_uid']);
$thumb = (isset($bbcode_img_to_array['img'][0]) ? $bbcode_img_to_array['img'][0] : (isset($bbcode_img_to_array['img'][0]) ? $bbcode_img_to_array['img'][0] : $default_image));
$template->assign_block_vars('topics_views', array(
'EVEN' => (($a % 2) ? false : true),
'THUMB' => $thumb,
'LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id']),
'TITLE' => $row['topic_title'],
'VIEWS' => $row['topic_views']
));
}
}
$db->sql_freeresult($result);
$sql = "SELECT p.post_text, p.bbcode_uid, t.* FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t WHERE t.forum_id IN (" . implode(', ', $forums_id) . ") AND p.post_id = t.topic_first_post_id ORDER BY topic_time DESC LIMIT 0," . $max_topic;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($auth->acl_get('f_read', $row['forum_id'])) {
$b++;
$bbcode_img_to_array = bbcode_img_to_array($row['post_text'], $row['bbcode_uid']);
$thumb = (isset($bbcode_img_to_array['img'][0]) ? $bbcode_img_to_array['img'][0] : (isset($bbcode_img_to_array['img'][0]) ? $bbcode_img_to_array['img'][0] : $default_image));
$template->assign_block_vars('topics_time', array(
'EVEN' => (($b % 2) ? false : true),
'THUMB' => $thumb,
'LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id']),
'TIME' => $user->format_date($row['topic_time'], false, false),
'TITLE' => $row['topic_title']
));
}
}
$db->sql_freeresult($result);
/*
* Parse [img] and [thumbnail] BBCode for messages and insert in an array BBCode params
*
* @param $msg string message to parse
* @param $uid string bbcode uid for message
*
*/
function bbcode_img_to_array($msg, $uid) {
$array_parsed_item = array();
$msg = str_replace("\n", '', $msg);
$msg = str_replace(array('[', ']'), array('<', '>'), $msg);
$msg = str_replace(':' . $uid, '', $msg);
$msg = preg_replace("|<url=(.*)>(.*)</url>|U", "<url>$1</url>", $msg);
preg_match_all("|<img>(.*)</img>|U", $msg, $array['img']);
preg_match_all("|<thumbnail>(.*)</thumbnail>|U", $msg, $array['thumbnail']);
$bbcode = array(
'img' => $array['img'][1],
'thumbnail' => $array['thumbnail'][1]
);
return $bbcode;
}
page_header('Topic più visti & Ultimi topic');
$template->set_filenames(array(
'body' => 'portal/block/topics_list.html',
));
page_footer();
?>
mentre in progray/template/portal/block
ho inserito questa cartellao un file chiamato topics_list.html con dentro questo codice
Codice: Seleziona tutto
<table class="tablebg" cellspacing="1" width="100%">
<h2>Topic più visti</h2>
<table border="0">
<!-- BEGIN topics_views -->
<!-- IF not topics_views.EVEN -->
<tr>
<!-- ENDIF -->
<td>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<h2><a href="{topics_views.LINK}">{topics_views.TITLE}</a></h2>
<div style="font-size: 1.2em;">
<table border="0">
<tr>
<td><img src="{topics_views.THUMB}" width="82" height="125" alt="{topics_views.TITLE}" title="{topics_views.TITLE}" /></td>
<td valign="center">
<a href="{topics_views.LINK}">{topics_views.TITLE}</a><br />
<em>Visite: <b>{topics_views.VIEWS}</b></em><br />
</td>
</tr>
</table>
</div>
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
</td>
<!-- IF topics_views.EVEN -->
</tr>
<!-- ENDIF -->
<!-- END topics_views -->
</table>
<h2>Ultimi topic</h2>
<table border="0">
<!-- BEGIN topics_time -->
<!-- IF not topics_time.EVEN -->
<tr>
<!-- ENDIF -->
<td>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<h2><a href="{topics_time.LINK}">{topics_time.TITLE}</a></h2>
<div style="font-size: 1.2em;">
<table border="0">
<tr>
<td><img src="{topics_time.THUMB}" width="82" height="125" alt="{topics_time.TITLE}" title="{topics_time.TITLE}" /></td>
<td valign="center">
<a href="{topics_time.LINK}">{topics_time.TITLE}</a><br />
<em>Data: <b>{topics_time.TIME}</b></em><br />
</td>
</tr>
</table>
</div>
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
</td>
<!-- IF topics_time.EVEN -->
</tr>
<!-- ENDIF -->
<!-- END topics_time -->
</table>
Poi ti volevo chiedere una cosa?? come posso far venire fuori una riga per ogni forum trattato, e non per tutti i forum che sono presi in cosiderazione ??
Perche si potrei fare che ne creo per il numero di forum che mi interessa fare questo.. però se qeusto avviene in automatico andrebbe meglio?!
ahah
