Zadejte hledaný výraz...

RSS – viac linkov

konrad
verified
rating uzivatele
16. 11. 2013 01:40:18
prajem dobry večer,
riešim tento kod ktory mi robi presne to čo potrebujem až nato že potrebujem čerpat z viacerych odkazov. Mal by prosim niekto napad? vopred velmi pekne dakujem!
$rss = new DOMDocument();
$rss->load('http://wordpress.org/news/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed);
$link = $feed;
$description = $feed;
$date = date('l F d, Y', strtotime($feed));
echo '

'.$title.'
';

echo 'Posted on '.$date.'

';
echo '

'.$description.'

';
}
?>
teda spravit niečo s:
$rss->load('http://wordpress.org/news/feed/');
16. 11. 2013 01:40:18
https://webtrh.cz/diskuse/rss-viac-linkov#reply966067
MadMax
verified
rating uzivatele
(1 hodnocení)
16. 11. 2013 10:32:07
Udelej si promennou pole z nekolika feedu a pole pak vypis v cyklu, jehoz obsahem bude tvuj kod jen do $rss->load() vzdy dosadis url feedu z vypisovaneho pole.
16. 11. 2013 10:32:07
https://webtrh.cz/diskuse/rss-viac-linkov#reply966066
konrad
verified
rating uzivatele
16. 11. 2013 12:49:01
Napsal MadMax;1022019
Udelej si promennou pole z nekolika feedu a pole pak vypis v cyklu, jehoz obsahem bude tvuj kod jen do $rss->load() vzdy dosadis url feedu z vypisovaneho pole.
vedeli by ste uviest i nejaky priklad? :D
16. 11. 2013 12:49:01
https://webtrh.cz/diskuse/rss-viac-linkov#reply966065
Lukenzi
verified
rating uzivatele
16. 11. 2013 14:46:26
proč vymýšlíš kolo? Použil bych třídu ze http://simplepie.org/ ,která je přesně k tomuhle učena.
16. 11. 2013 14:46:26
https://webtrh.cz/diskuse/rss-viac-linkov#reply966064
MadMax
verified
rating uzivatele
(1 hodnocení)
16. 11. 2013 18:57:53
Nebo asi takhle
16. 11. 2013 18:57:53
https://webtrh.cz/diskuse/rss-viac-linkov#reply966063
Sonia
verified
rating uzivatele
16. 11. 2013 20:27:30
dakujem ale tento kod nejde
Napsal MadMax;1022122
Nebo asi takhle
16. 11. 2013 20:27:30
https://webtrh.cz/diskuse/rss-viac-linkov#reply966062
konrad
verified
rating uzivatele
16. 11. 2013 22:17:06
Chyba je:
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 15
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Warning: DOMDocument::load(): Empty string supplied as input in C:wampwwwlolifenews.php on line 15
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
2 4.0672 178312 load ( ) ..news.php:15
( ! ) Notice: Undefined offset: 0 in C:wampwwwlolifenews.php on line 28
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 0 in C:wampwwwlolifenews.php on line 29
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 0 in C:wampwwwlolifenews.php on line 30
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 0 in C:wampwwwlolifenews.php on line 31
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
Posted on Thursday January 01, 1970
( ! ) Notice: Undefined offset: 1 in C:wampwwwlolifenews.php on line 28
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 1 in C:wampwwwlolifenews.php on line 29
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 1 in C:wampwwwlolifenews.php on line 30
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 1 in C:wampwwwlolifenews.php on line 31
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
Posted on Thursday January 01, 1970
( ! ) Notice: Undefined offset: 2 in C:wampwwwlolifenews.php on line 28
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 2 in C:wampwwwlolifenews.php on line 29
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 2 in C:wampwwwlolifenews.php on line 30
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 2 in C:wampwwwlolifenews.php on line 31
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
Posted on Thursday January 01, 1970
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 28
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 29
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 30
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 31
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
Posted on Thursday January 01, 1970
( ! ) Notice: Undefined offset: 4 in C:wampwwwlolifenews.php on line 28
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 4 in C:wampwwwlolifenews.php on line 29
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 4 in C:wampwwwlolifenews.php on line 30
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
( ! ) Notice: Undefined offset: 4 in C:wampwwwlolifenews.php on line 31
Call Stack
# Time Memory Function Location
1 0.0110 150440 {main}( ) ..news.php:0
---------- Příspěvek doplněn 16.11.2013 v 22:24 ----------
Tak už len toto mi zostalo:
( ! ) Notice: Undefined offset: 3 in C:wampwwwlolifenews.php on line 16
Call Stack
# Time Memory Function Location
1 0.0040 150448 {main}( ) ..news.php:0
( ! ) Warning: DOMDocument::load(): Empty string supplied as input in C:wampwwwlolifenews.php on line 16
Call Stack
# Time Memory Function Location
1 0.0040 150448 {main}( ) ..news.php:0
2 4.2722 199248 load ( ) ..news.php:16
---------- Příspěvek doplněn 16.11.2013 v 22:26 ----------
16 je $rss->load($feedarray);
---------- Příspěvek doplněn 16.11.2013 v 22:53 ----------
zabudol som kod tak tu je...
$feed = array();
$feedarray = array("http://wordpress.org/news/feed/", "http://wordpress.org/news/feed/", "http://wordpress.org/news/feed/");
for ($i=0; $i<=count($feedarray); $i++) {
$rss = new DOMDocument();
$rss->load($feedarray);
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed);
$link = $feed;
$description = $feed;
$date = date('l F d, Y', strtotime($feed));
echo '

'.$title.'
';

echo 'Posted on '.$date.'

';
echo '

'.$description.'

';
}
}
?>
16. 11. 2013 22:17:06
https://webtrh.cz/diskuse/rss-viac-linkov#reply966061
MadMax
verified
rating uzivatele
(1 hodnocení)
17. 11. 2013 10:22:54
Opraveny radek s for, kdyz to dam cele do samostatneho souboru tak to bezi bez chyb
17. 11. 2013 10:22:54
https://webtrh.cz/diskuse/rss-viac-linkov#reply966060
konrad
verified
rating uzivatele
17. 11. 2013 10:55:38
Napsal MadMax;1022216
Opraveny radek s for, kdyz to dam cele do samostatneho souboru tak to bezi bez chyb
velmi pekne dakujem :) presne to som potreboval
17. 11. 2013 10:55:38
https://webtrh.cz/diskuse/rss-viac-linkov#reply966059
Pro odpověď se přihlašte.
Přihlásit