Mostrar últimos temas del foro como enlaces

  • Autor Autor Franyer Rivas
  • Fecha de inicio Fecha de inicio
Franyer Rivas

Franyer Rivas

1
Pi
Verificado
Verificación en dos pasos activada
Verificado por Whatsapp
¡Ha verificado su Paypal!
Verificado por Binance
Suscripción a IA
saludos estoy buscando mostrar en mi web los ultimos temas de mi foro que esta en vbulletin consegui un codigo sencillo que es el que deseo pero tengo un pequeño problema xD no se mucho de php 🙁 y quiero eliminar de la linea de codigo que muestre la descripcion solo quiero que muestre el titulo como un enlace para yo postereor mente crear un marquee para insertarlo en el chat y asi puedan saber los ultimos temas en el foro de paso se pueden quedar con el codigo que es muy util :flute:
?php

class RssReader {
var $url;
var $data;

function RssReader ($url){
$this->url;
$this->data = implode ("", file ($url));
}

function get_items (){
preg_match_all ("/<item .*>.*<\/item>/xsmUi", $this->data, $matches);
$items = array ();
foreach ($matches[0] as $match){
$items[] = new RssItem ($match);
}
return $items;
}
}

class RssItem {
var $title, $url, $description;

function RssItem ($xml){
$this->populate ($xml);
}

function populate ($xml){
preg_match ("/<title> (.*) <\/title>/xsmUi", $xml, $matches);
$this->title = $matches[1];
preg_match ("/<link> (.*) <\/link>/xsmUi", $xml, $matches);
$this->url = $matches[1];
preg_match ("/<description> (.*) <\/description>/xsmUi", $xml, $matches);
$this->description = $matches[1];
}

function get_title (){
return $this->title;
}

function get_url (){
return $this->url;
}

function get_description (){
return $this->description;
}
}

$rss = new RssReader ("http://animeak.com/foro/external.php?type=RSS2");

foreach ($rss->get_items () as $item){
printf ('<a href="%s">%s</a><br />%s<br /><br />',
$item->get_url (), $item->get_title (), $item->get_description ());
}
?>

quiero que solo mueste el titulo ejemplo

probando (como un enlace al tema )
de antemano muchas gracias solo indiquenme que tengo que quitarle al codigo intente eliminando la linea , $item->get_description () pero me da error -__-
 
solo elimina $item->get_description () no toda la linea quedaria asi

$item->get_url (), $item->get_title ());
 
PHP:
?php

class RssReader {
var $url;
var $data;

function RssReader ($url){
$this->url;
$this->data = implode ("", file ($url));
}

function get_items (){
preg_match_all ("/<item .*>.*<\/item>/xsmUi", $this->data, $matches);
$items = array ();
foreach ($matches[0] as $match){
$items[] = new RssItem ($match);
}
return $items;
}
}

class RssItem {
var $title, $url;

function RssItem ($xml){
$this->populate ($xml);
}

function populate ($xml){
preg_match ("/<title> (.*) <\/title>/xsmUi", $xml, $matches);
$this->title = $matches[1];
preg_match ("/<link> (.*) <\/link>/xsmUi", $xml, $matches);
$this->url = $matches[1];
}

function get_title (){
return $this->title;
}

function get_url (){
return $this->url;
}


}

$rss = new RssReader ("http://animeak.com/foro/external.php?type=RSS2");

foreach ($rss->get_items () as $item){
printf ('<a href="%s">%s</a><br />%s<br /><br />',
$item->get_url (), $item->get_title ());
}
?>

Proba asi aver que onda.
 
de la forma que me menciono diego me da este error
Warning: printf() [function.printf]: Too few arguments in /home/animeak/public_html/rssak.php on line 55

y la segunda forma me da el siguiente error
Warning: printf() [function.printf]: Too few arguments in /home/animeak/public_html/rssak.php on line 51

D: 🙁
 
de la forma que me menciono diego me da este error


y la segunda forma me da el siguiente error


D: 🙁
este codigo te servira ... es muy basico y solo muestra el titulo pero no descripcion ni contenido de tema..
PHP:
<?php
$el_rss['']='http://animeak.com/foro/external.php?type=RSS2';
	while (list($kk, $vv) = each($el_rss)) {
		echo '<h3>'.$kk.'</h3>';
		$contenido=file_get_contents($vv);
		$xml =  simplexml_load_string($contenido);
	foreach ($xml->channel->item as $i){
		echo '<a href="'.$i->link.'" title="'.utf8_decode($i->title).'" target="_blank"><h3>'.utf8_decode($i->title).'</h3></a>';

		echo '<hr>';
			}
	}
?>
 
genial hermano este si me funciono OWO un millon de gracias ^^

y dale que hermano,hombre,man, soy mujer no ven mi avatar 🙂 ... y que bueno que te haya servido dale un dedito verde 😀
 
XD lo siento no me fijo en el avatar de los user xD gracias por la ayuda dedito verde bella dama N___N
 
jkmade, a ese código se le pueden agregar varios feeds? necesito uno pero que agarre varios feeds =)

PD: para no abrir otro tema 😉
 
Atrás
Arriba