Ik heb een vreemd probleem. Ik heb een weblog via Wordpress.com. Daarvandaan kan een RSS feed komen voor publicaties op andere sites.
Ik heb een koppeling met mijn eigen site. Voorheen gebruikte ik Blogger en werden alle artikelen goed getoond. Nu via Wordpress wordt van een post maar de eerste 50 woorden of zo getoond en wordt een [...] toegevoegd.
In het Wordpress dashboard heb ik ingesteld dat de volledige artikelen getoond moeten worden.
Nu het vreemde: als je de feed opent in Firefox, worden de artikelen deels getoond. Open je de feed in IE daarentegen, worden de volledige artikelen getoond!
Link naar de feed: http://marcovanderknaap.wordpress.com/feed/
In het script op mijn pagina gebruik ik de volgende code:
en om de artikelen te tonen:
Iemand een idee hoe ik nu het volledige bericht op m'n site kan tonen?
Ik heb een koppeling met mijn eigen site. Voorheen gebruikte ik Blogger en werden alle artikelen goed getoond. Nu via Wordpress wordt van een post maar de eerste 50 woorden of zo getoond en wordt een [...] toegevoegd.
In het Wordpress dashboard heb ik ingesteld dat de volledige artikelen getoond moeten worden.
Nu het vreemde: als je de feed opent in Firefox, worden de artikelen deels getoond. Open je de feed in IE daarentegen, worden de volledige artikelen getoond!
Link naar de feed: http://marcovanderknaap.wordpress.com/feed/
In het script op mijn pagina gebruik ik de volgende code:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
| $itemNum=0; class RSSParser { var $channel_title=""; var $channel_website=""; var $channel_description=""; var $channel_pubDate=""; var $channel_lastUpdated=""; var $channel_copyright=""; var $title=""; var $link=""; var $description=""; var $pubDate=""; var $author=""; var $url=""; var $width=""; var $height=""; var $inside_tag=false; function RSSParser($file,$encType) { $this->xml_parser = xml_parser_create($encType); xml_set_object( $this->xml_parser, &$this ); xml_set_element_handler( $this->xml_parser, "startElement", "endElement" ); xml_set_character_data_handler( $this->xml_parser, "characterData" ); $fp = @fopen("$file","r") or die( "$file could not be opened" ); while ($data = fread($fp, 2048)){xml_parse( $this->xml_parser, $data, feof($fp)) or die( "XML error");} fclose($fp); xml_parser_free( $this->xml_parser ); } function startElement($parser,$tag,$attributes=''){ $this->current_tag=$tag; if($this->current_tag=="ITEM" || $this->current_tag=="IMAGE"){ $this->inside_tag=true; $this->description=""; $this->link=""; $this->title=""; $this->pubDate=""; } } function endElement($parser, $tag){ switch($tag){ case "ITEM": $this->titles[]=trim($this->title); $this->links[]=trim($this->link); $this->descriptions[]=trim($this->description); $this->pubDates[]=trim($this->pubDate); $this->authors[]=trim($this->author); $this->author=""; $this->inside_tag=false; break; case "IMAGE": $this->channel_image="<img src=\"".trim($this->url)."\" width=\"".trim($this->width)."\" height=\"".trim($this->height)."\" alt=\"".trim($this->title)."\" border=\"0\" title=\"".trim($this->title)."\" />"; $this->title=""; $this->inside_tag=false; default: break; } } function characterData($parser,$data){ if($this->inside_tag){ switch($this->current_tag){ case "TITLE": $this->title.=$data; break; case "DESCRIPTION": $this->description.=$data; break; case "LINK": $this->link.=$data; break; case "URL": $this->url.=$data; break; case "WIDTH": $this->width.=$data; break; case "HEIGHT": $this->height.=$data; break; case "PUBDATE": $this->pubDate.=$data; break; case "AUTHOR": $this->author.=$data; break; default: break; }//end switch }else{ switch($this->current_tag){ case "DESCRIPTION": $this->channel_description.=$data; break; case "TITLE": $this->channel_title.=$data; break; case "LINK": $this->channel_website.=$data; break; case "COPYRIGHT": $this->channel_copyright.=$data; break; case "PUBDATE": $this->channel_pubDate.=$data; break; case "LASTBUILDDATE": $this->channel_lastUpdated.=$data; break; default: break; } } } } $m2 = new RSSParser("http://marcovanderknaap.wordpress.com/feed/","UTF-8"); |
en om de artikelen te tonen:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
| <?php $m2_RSSmax=10; if($m2_RSSmax==0 || $m2_RSSmax>count($m2->titles))$m2_RSSmax=count($m2->titles); for($itemNum=0;$itemNum<$m2_RSSmax;$itemNum++){?> <div id="WebLog"> <p><?php echo "<a href='",$m2->links[$itemNum],"' target='_blank'>",$m2->titles[$itemNum],"</a>"; ?></p> <?php echo $m2->descriptions[$itemNum]; ?><br> <?php echo "<a href='",$m2->links[$itemNum],"' target='_blank'>Lees verder...</a>"; ?><br> <i>Toegevoegd op: <?php echo $m2->pubDates[$itemNum]; ?></i> </div> <br><br><hr><br><br> <?php } ?> |
Iemand een idee hoe ik nu het volledige bericht op m'n site kan tonen?