Ciao a tutti... questo post può esser pubblicato anche nella sezione joomla, ma ritengo sia più idoneo per questa sezione.
Vengo al dunque:
volevo modificare il modulo phpbb3 last topic
Praticamente il modulo mi stampa a video:
Io volevo apportare la modifica che mi permettesse di avere invece:
NOME_FORUM - TITOLO_TOPIC
È fattibile?
il file interessato è:
Codice PHP:
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php
if($list&&is_array($list))
{
foreach($list as $item)
{
$forum_id = $item->forum_id;
$topic_id = $item->topic_id;
$topic_title = $item->topic_title;
$post_text = $item->post_text;
$post_id = $item->post_id;
/* building link url */
$baseurl = trim( $params->get( 'baseurl' ) );
$pagename = trim( $params->get( 'pagename' ) );
$direct_link = trim( $params->get( 'direct_link' ) );
$forumidtag = trim( $params->get( 'forumidtag' ) );
$topicidtag = trim( $params->get( 'topicidtag' ) );
switch($direct_link)
{
case 1:
$url = $baseurl."/viewtopic.php?".$forumidtag."=".$forum_id."&".$topicidtag."=".$topic_id;
break;
case 2:
$url = $baseurl."/viewforum.php?".$forumidtag."=".$forum_id;
break;
default:
$url = $baseurl."/viewtopic.php?".$forumidtag."=".$forum_id."&".$topicidtag."=".$topic_id."#p".$post_id;
// $url = $baseurl."/viewtopic.php?p=".$post_id."#p".$post_id;
}
/* end of building link url */
/* building time */
$formatdate = trim( $params->get( 'formatdate' ) );
// $date = new JDate ($item->post_time);
$date = & JFactory:: getDate ($item->post_time); //thanks to Fleiva
$post_time = $date->toFormat($formatdate);
/* end of building time */
/* building the user name */
if($item->username)
$username = $item->username;
else
$username = $item->post_username;
/* end of building the user name */
$title = $topic_title." (".$username.")";
echo "<ul>";
echo "<li><a href=\"".$url."\">".$topic_title."[/url][br /] </li>";
/* echo "<li>".$post_time." <a href=\"".$url."\">".$topic_title."[/url][br /] (".$username.")</li>";
/* echo "<li> <a href=\"".$url."\">".$topic_title."[/url]</li>";*/
echo "</ul>";
}
}
else
{
echo JTEXT::_('NO_POSTS');
}
?>
Bisonga agire sulla riga
Codice PHP:
echo "<li><a href=\"".$url."\">".$topic_title."[/url][br /] </li>";
come potrei fare a richiamargli anche il nome del forum di appartenenza?
vi ringrazio
EDIT:
ho provato cosi:
Codice PHP:
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php
if($list&&is_array($list))
{
foreach($list as $item)
{
$forum_id = $item->forum_id;
$topic_id = $item->topic_id;
$topic_title = $item->topic_title;
$post_text = $item->post_text;
$post_id = $item->post_id;
/* building link url */
$baseurl = trim( $params->get( 'baseurl' ) );
$pagename = trim( $params->get( 'pagename' ) );
$direct_link = trim( $params->get( 'direct_link' ) );
$forumidtag = trim( $params->get( 'forumidtag' ) );
$topicidtag = trim( $params->get( 'topicidtag' ) );
switch($direct_link)
{
case 1:
$url = $baseurl."/viewtopic.php?".$forumidtag."=".$forum_id."&".$topicidtag."=".$topic_id;
break;
case 2:
$url = $baseurl."/viewforum.php?".$forumidtag."=".$forum_id;
break;
default:
$url = $baseurl."/viewtopic.php?".$forumidtag."=".$forum_id."&".$topicidtag."=".$topic_id."#p".$post_id;
// $url = $baseurl."/viewtopic.php?p=".$post_id."#p".$post_id;
}
/* end of building link url */
/* building time */
$formatdate = trim( $params->get( 'formatdate' ) );
// $date = new JDate ($item->post_time);
$date = & JFactory:: getDate ($item->post_time); //thanks to Fleiva
$post_time = $date->toFormat($formatdate);
/* end of building time */
/* building the user name */
if($item->username)
$username = $item->username;
else
$username = $item->post_username;
/* end of building the user name */
$title = $topic_title." (".$username.")";
echo "<ul>";
/* echo "<li><a href=\"".$url."\">".$topic_title."</a><br/> </li>";*/
// echo "<li>".$post_time." <a href=\"".$url."\">".$topic_title."</a><br/></li>"
// echo "<li> <a href=\"".$url."\">".$topic_title."</a></li>";
//modifica
$nome_sito='*******';
$db_host='localhost';
$db_user='*********';
$db_pass='**********';
$database_name='my_********';
mysql_connect($db_host,$db_user,$db_pass)or die("non riesco a connettermi");
mysql_select_db($database_name)or die("non riesco selezionare il database");
$sql = "SELECT forum_name FROM phpbb_forums WHERE forum_id=$forum_id";
$dati=mysql_query($sql);
while ($fetchM=mysql_fetch_row($dati))
{
$forum.=$fetchM[0];
echo "<li><a href=\"".$url."\">".$forum." - ".$topic_title."</a><br/> </li>";
}
echo "</ul>";
}
}
else
{
echo JTEXT::_('NO_POSTS');
}
?>
e in un certo senso funziona ma mi vegnono stampati cosi:
- nome_forum1 - titolo_topic1
- nome_forum1 nome_forum2 - titolo_topic2
- nome_forum1 nome_forum2 nome_forum3 - titolo_topic3
- nome_forum1 nome_forum2 nome_forum3 nome_forum4- titolo_topic4
e cosi via.... come posso risolvere?
EDIT:
nessun0?