Página 1 de 1
Ultimos post/topic en un html para verlo por iframe Tema Solucionado
Publicado: 26 Mar 2016, 13:26
por chicosandro2004
Hola
he actualizado a 3.1.8 y este mod ya no me funciona...
alguien sabrá donde encontrarlo actualizado para dicha version?
se lo agradecería mucho ya que me es muy necesario
Código: Seleccionar todo
<?php
// Amount of active topics to show
define("TOPIC_COUNT", 8);
// Path to the phpBB 3.0 root directory
define("PHPBB_PATH", "../foros/");
// URL to the phpBB 3.0 installation
define("PHPBB_LOCATION", "http://www.rompelo.cl/foros/");
// Time format to output the date/time (for format see PHP manual)
define("TIME_FORMAT", "d/m/Y");
// php extension using
$phpEx = "php";
// No Editing unless you know what your doing
if ( !defined('IN_PHPBB') )
{
define('IN_PHPBB', true);
}
// Get the needed phpbb files, thank you phpbb =]
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// HTML header start
?>
<style>
a:link,
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: none;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: underline;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: none;
}
</style>
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Titulo</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Visitas</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Respuesta</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Ultimos mensajes</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Fecha</font></th>
</tr>
<?php
// HTML header end
$sql = "SELECT DISTINCT t.topic_title, t.topic_id,t.topic_views,t.topic_replies, t.topic_last_post_id,
p.post_time,p.poster_id, f.forum_name, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f, " . USERS_TABLE . " AS u
WHERE
t.forum_id = f.forum_id
AND p.topic_id = t.topic_id
AND p.poster_id = u.user_id
AND p.post_id = t.topic_last_post_id
ORDER BY p.post_time DESC LIMIT " . TOPIC_COUNT;
$nt_result = $db->sql_query($sql);
if(!$nt_result)
{
die("Failed obtaining list of active topics".mysql_error());
}
else
{
$nt_data = $db->sql_fetchrowset();
}
if ( count($nt_data) == 0 )
{
die("No topics found");
}
else
{
$cq = 1;
$cc = FFFFFF;
// $nt_data contains all interesting data
for ($i = 0; $i < count($nt_data); $i++)
{
$title = $nt_data[$i]['topic_title'];
$Turl = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?t=" . $nt_data[$i]['topic_id'];
$LPurl = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?p" . "=" . $nt_data[$i]['topic_last_post_id'] . "#p" . $nt_data[$i]['topic_last_post_id'];
$on_forum = 'Forum ' . $nt_data[$i]['forum_name'];
$post_time = date(TIME_FORMAT, $nt_data[$i]['post_time']);
//Profile profile.php?mode=viewprofile&u=23
$profile = PHPBB_LOCATION . 'memberlist.' . $phpEx . "?mode=viewprofile&u=" . $nt_data[$i]['poster_id'] ;
$usrname = $nt_data[$i]['username'];
// Item HTML start
if($cq%2 == 0){$cc = E8EFF4;$cq++;} else{$cc = E8EFF4;$cq++;}?>
<tr>
<td bgcolor="#<?php echo $cc;?>" align="left"><a href="<?php echo $LPurl; ?>" title="<?php echo $on_forum; ?>"
target="_parent"><font face="verdana" color="#496C9F" size="1"><B><?php echo $title; ?></B></font></a></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><div align="center"><font face="verdana" color="#5B5B5B" size="1"><?php echo
$nt_data[$i]['topic_views'] ?></div></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#5B5B5B" size="1"><div align="center"><?php echo
$nt_data[$i]['topic_replies'] ?></div></td>
<td align="center" bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#666666" size="1"><a href="<?php
echo $profile; ?>" target="_parent"><font face="verdana" color="#496C9F" size="1"><B><?php echo $usrname?></B></a></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#5B5B5B" size="1"><div align="center"><?php echo
$post_time ?></div></td>
</tr>
<?php
// Item HTML end
}
}
// Footer HTML start
?>
URL: www.rompelo.cl/foros
Estilo(s) usuado(s): quarto_asphalt_light
Extensiones instaladas: board3, entre otras que estoy subiendo
Versión de phpBB: 3.1.8
Servidor: dedicado
Si es una actualización desde otra versión: pase de 3.0 a 3.1
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 26 Mar 2016, 16:42
por nextgen
¿Qué te falla?
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 27 Mar 2016, 10:46
por chicosandro2004
este es el codigo de error
en el link se puede ver directo
http://www.rompelo.cl/foros/topic.php
Código: Seleccionar todo
Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\RuntimeException' with message 'A string value must be composed of strings and/or numbers, but found parameter "core.root_path" of type NULL inside string value "%core.root_path%includes/".' in /home/rompelo/public_html/foros/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php:235 Stack trace: #0 [internal function]: Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->Symfony\Component\DependencyInjection\ParameterBag\{closure}(Array) #1 /home/rompelo/public_html/foros/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(242): preg_replace_callback('/%%|%([^%\\s]+)%...', Object(Closure), '%core.root_path...') #2 /home/rompelo/public_html/foros/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php(187): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->resolveString in /home/rompelo/public_html/foros/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php on line 235
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 28 Mar 2016, 10:09
por Bermúdez
Chicosandro2004, para evitar problemas, antes de actualizar de 3.0.xx a 3.1.x deberías haber desinstalado completa y absolutamente todos los mods, ya que los mods son incompatibles con la nueva versión 3.1.x de phpbb.
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 29 Mar 2016, 10:17
por chicosandro2004
si, los deshimtale todos...
pero este mod o nose como llamarle, es solo una pagina "topic.php" que se mete dentro de la raiz del foro, modificas la ruta y ya esta...
tonces no era un mod que antes funcionaba bien y ahora no....
ojala pueda alguien ayudarme ya que igual es bien util este topic.php ya que puedes ver los posteos de mi foro en otros sitios...
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 03 Abr 2016, 07:02
por towen
Prueba con este código, la manera de hacer las cosas en phpbb3.1 es mediante extensiones y este tipo de modificación no se considera correcto usarla (pero es más rápido corregirla que llevarla a extensión)
Código: Seleccionar todo
<?php
// Amount of active topics to show
define("TOPIC_COUNT", 8);
// URL to the phpBB installation
define("PHPBB_LOCATION", "http://www.rompelo.cl/foros/");
// Time format to output the date/time (for format see PHP manual)
define("TIME_FORMAT", "d/m/Y");
// php extension using
$phpEx = "php";
// No Editing unless you know what your doing
if ( !defined('IN_PHPBB') )
{
define('IN_PHPBB', true);
}
$phpbb_root_path = './';
// Get the needed phpbb files, thank you phpbb =]
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// HTML header start
?>
<style>
a:link,
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: none;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: underline;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #496c9f;
text-decoration: none;
}
</style>
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Titulo</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Visitas</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Respuestas</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Ultimos mensajes</font></th>
<th align="center" bgcolor="#DFE6EF"><font color="#5F5757" size="2">Fecha</font></th>
</tr>
<?php
// HTML header end
$sql = "SELECT DISTINCT t.topic_title, t.topic_id,t.topic_views,t.topic_posts_approved, t.topic_last_post_id,
p.post_time,p.poster_id, f.forum_name, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . FORUMS_TABLE . " AS f, " . USERS_TABLE . " AS u
WHERE
t.forum_id = f.forum_id
AND p.topic_id = t.topic_id
AND p.poster_id = u.user_id
AND p.post_id = t.topic_last_post_id
ORDER BY p.post_time DESC LIMIT " . TOPIC_COUNT;
$nt_result = $db->sql_query($sql);
if(!$nt_result)
{
die("Failed obtaining list of active topics".mysql_error());
}
else
{
$nt_data = $db->sql_fetchrowset();
}
if ( count($nt_data) == 0 )
{
die("No topics found");
}
else
{
$cq = 1;
$cc = 'FFFFFF';
// $nt_data contains all interesting data
for ($i = 0; $i < count($nt_data); $i++)
{
$title = $nt_data[$i]['topic_title'];
$Turl = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?t=" . $nt_data[$i]['topic_id'];
$LPurl = PHPBB_LOCATION . 'viewtopic.' . $phpEx . "?p" . "=" . $nt_data[$i]['topic_last_post_id'] . "#p" . $nt_data[$i]['topic_last_post_id'];
$on_forum = 'Forum ' . $nt_data[$i]['forum_name'];
$post_time = date(TIME_FORMAT, $nt_data[$i]['post_time']);
//Profile profile.php?mode=viewprofile&u=23
$profile = PHPBB_LOCATION . 'memberlist.' . $phpEx . "?mode=viewprofile&u=" . $nt_data[$i]['poster_id'] ;
$usrname = $nt_data[$i]['username'];
// Item HTML start
if($cq%2 == 0){$cc = 'E8EFF4';$cq++;} else{$cc = 'E8EFF4';$cq++;}?>
<tr>
<td bgcolor="#<?php echo $cc;?>" align="left"><a href="<?php echo $LPurl; ?>" title="<?php echo $on_forum; ?>"
target="_parent"><font face="verdana" color="#496C9F" size="1"><B><?php echo $title; ?></B></font></a></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><div align="center"><font face="verdana" color="#5B5B5B" size="1"><?php echo
$nt_data[$i]['topic_views'] ?></div></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#5B5B5B" size="1"><div align="center"><?php echo
$nt_data[$i]['topic_posts_approved'] ?></div></td>
<td align="center" bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#666666" size="1"><a href="<?php
echo $profile; ?>" target="_parent"><font face="verdana" color="#496C9F" size="1"><B><?php echo $usrname?></B></a></td>
<td bgcolor="#<?php echo $cc;?>" align="left"><font face="verdana" color="#5B5B5B" size="1"><div align="center"><?php echo
$post_time ?></div></td>
</tr>
<?php
// Item HTML end
}
}
// Footer HTML start
?>
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 05 Abr 2016, 00:36
por chicosandro2004
exelente... esta modificacion es del codigo nuevo o es lo que yo mas arriba coloque?
gracias y aquí queda esta extencion para quienes quieran usarla
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 05 Abr 2016, 00:54
por chicosandro2004
me podría ayudar con este... es similar al otro pero en este, solo muestro un foro en especifico... a diferecia del otro, me muestra los últimos posteos de todos los foros
Código: Seleccionar todo
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../foros/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing
* posts and topics */
function create_where_clauses($gen_id, $type)
{
global $db, $auth;
$size_gen_id = sizeof($gen_id);
switch($type)
{
case 'forum':
$type = 'forum_id';
break;
case 'topic':
$type = 'topic_id';
break;
default:
trigger_error('No type defined');
}
// Set $out_where to nothing, this will be used of the gen_id
// size is empty, in other words "grab from anywhere" with
// no restrictions
$out_where = '';
if ($size_gen_id > 0)
{
// Get a list of all forums the user has permissions to read
$auth_f_read = array_keys($auth->acl_getf('f_read', true));
if ($type == 'topic_id')
{
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $gen_id) . '
AND ' . $db->sql_in_set('forum_id', $auth_f_read);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Create an array with all acceptable topic ids
$topic_id_list[] = $row['topic_id'];
}
unset($gen_id);
$gen_id = $topic_id_list;
$size_gen_id = sizeof($gen_id);
}
$j = 0;
for ($i = 0; $i < $size_gen_id; $i++)
{
$id_check = (int) $gen_id[$i]; // If the type is topic, all checks have been made and the query can start to be built if( $type == 'topic_id' ) { $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' '; } // If the type is forum, do the check to make sure the user has read permissions else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
{
$out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
}
$j++;
}
}
if ($out_where == '' && $size_gen_id > 0)
{
trigger_error('A list of topics/forums has not been created');
}
return $out_where;
}
?>
<link rel="stylesheet" type="text/css" href="http://www.ponelo.cl/clasificados/style/foros.css"/>
<body bgcolor="#111111">
<?php
// Número de últimos posts a mostrar:
$search_limit = 2;
// ID del foro específico. Si deseas más de un foro, separar por "comas".
$forum_id = array(4);
$forum_id_where = create_where_clauses($forum_id, 'forum');
$topics = 'SELECT * FROM ' . TOPICS_TABLE . '
' . $forum_id_where . '
AND topic_status <> ' . ITEM_MOVED . '
AND topic_approved = 1
ORDER BY topic_id DESC';
$topics_result = $db->sql_query_limit($topics, $search_limit);
while ($topics_row = $db->sql_fetchrow($topics_result))
{
//$topic_title = $topics_row['topic_title'];
$topic_title=substr($topics_row["topic_title"],0,20)."";
$topic_title = censor_text($topic_title);
$topic_author = get_username_string('full', $topics_row['topic_poster'], $topics_row['topic_first_poster_name'], $topics_row['topic_first_poster_colour']);
$topic_date = $user->format_date($topics_row['topic_time']);
$topic_last_post = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $topics_row['topic_last_post_id'] . "#" . $topics_row['topic_last_post_id']);
$topic_last_author = get_username_string('full', $topics_row['topic_last_poster_id'], $topics_row['topic_last_poster_name'], $topics_row['topic_last_poster_colour']);
$topic_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=" . $topics_row['topic_id']);
echo "
<div id='foro2' align=\"left\">
<a href=\"$topic_link\" target=\"_black\" style=\"font-size:13px;text-transform:lowercase; overflow:hidden\">$topic_title</a> <!-- por $topic_author - $topic_date -->
</div>
<img src=\"http://ponelo.cl/trasparente.gif\" height=\"2\">
";
}
?>
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 06 Abr 2016, 00:37
por towen
Prueba con este, los dos son modificaciones de los originales que pusiste adaptándolo a como está guardada la información en la base de dato en la nueva versión. No son extensiones, son solo scripts externos que sacan información de phpbb.
Código: Seleccionar todo
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../foros/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing
* posts and topics */
function create_where_clauses($gen_id, $type)
{
global $db, $auth;
$size_gen_id = sizeof($gen_id);
switch($type)
{
case 'forum':
$type = 'forum_id';
break;
case 'topic':
$type = 'topic_id';
break;
default:
trigger_error('No type defined');
}
// Set $out_where to nothing, this will be used of the gen_id
// size is empty, in other words "grab from anywhere" with
// no restrictions
$out_where = '';
if ($size_gen_id > 0)
{
// Get a list of all forums the user has permissions to read
$auth_f_read = array_keys($auth->acl_getf('f_read', true));
if ($type == 'topic_id')
{
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $gen_id) . '
AND ' . $db->sql_in_set('forum_id', $auth_f_read);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Create an array with all acceptable topic ids
$topic_id_list[] = $row['topic_id'];
}
unset($gen_id);
$gen_id = $topic_id_list;
$size_gen_id = sizeof($gen_id);
}
$j = 0;
for ($i = 0; $i < $size_gen_id; $i++)
{
$id_check = (int) $gen_id[$i]; // If the type is topic, all checks have been made and the query can start to be built if( $type == 'topic_id' ) { $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' '; } // If the type is forum, do the check to make sure the user has read permissions else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
{
$out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
}
$j++;
}
}
if ($out_where == '' && $size_gen_id > 0)
{
trigger_error('A list of topics/forums has not been created');
}
return $out_where;
}
?>
<link rel="stylesheet" type="text/css" href="http://www.ponelo.cl/clasificados/style/foros.css"/>
<body bgcolor="#111111">
<?php
// Número de últimos posts a mostrar:
$search_limit = 2;
// ID del foro específico. Si deseas más de un foro, separar por "comas".
$forum_id = array(4);
$forum_id_where = create_where_clauses($forum_id, 'forum');
$topics = 'SELECT * FROM ' . TOPICS_TABLE . '
' . $forum_id_where . '
AND topic_status <> ' . ITEM_MOVED . '
AND topic_visibility = ' . ITEM_APPROVED .'
ORDER BY topic_id DESC';
$topics_result = $db->sql_query_limit($topics, $search_limit);
while ($topics_row = $db->sql_fetchrow($topics_result))
{
//$topic_title = $topics_row['topic_title'];
$topic_title=substr($topics_row["topic_title"],0,20)."";
$topic_title = censor_text($topic_title);
$topic_author = get_username_string('full', $topics_row['topic_poster'], $topics_row['topic_first_poster_name'], $topics_row['topic_first_poster_colour']);
$topic_date = $user->format_date($topics_row['topic_time']);
$topic_last_post = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $topics_row['topic_last_post_id'] . "#" . $topics_row['topic_last_post_id']);
$topic_last_author = get_username_string('full', $topics_row['topic_last_poster_id'], $topics_row['topic_last_poster_name'], $topics_row['topic_last_poster_colour']);
$topic_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=" . $topics_row['topic_id']);
echo "
<div id='foro2' align=\"left\">
<a href=\"$topic_link\" target=\"_black\" style=\"font-size:13px;text-transform:lowercase; overflow:hidden\">$topic_title</a> <!-- por $topic_author - $topic_date -->
</div>
<img src=\"http://ponelo.cl/trasparente.gif\" height=\"2\">
";
}
?>
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 07 Abr 2016, 18:33
por chicosandro2004
vale, muchas gracias por su ayuda.
pregunta: se puede colocar este script en otro dominio y desde alla llamar a la raiz del foro?
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 08 Abr 2016, 00:34
por towen
esos no funcionarían
Re: Ultimos post/topic en un html para verlo por iframe
Publicado: 08 Abr 2016, 01:25
por chicosandro2004
vale.. fuiste muy amable... si tienes una cuenta paypal me la das por skype y te regalo algunos usd como agradecimiento
tema solucionado..