Phpbb 3 RSS Feed met SEO voor diverse kanale.
Quote:
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
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
<?php
// We willen GEEN php, maar xml:
header ('Content-Type: text/xml');
// Verbinden met de database
define ('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forum_cms/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Errors voorkomen:
if(empty($_GET['feed']))
$feed = 'Geen berichten';
else
$feed = $_GET['feed'];
// Begin maken:
echo "<?xml version=\"1.0\" encoding=\"windows-1252\"?>
<rss version=\"2.0\" xmlns:coop=\"http://www.google.com/coop/namespace\">
<channel>
<title>Factscommunity.nl - Nieuws</title>
<link>http://www.factscommunity.nl/nieuws-f46/</link>
<description>Het laatste Gaming nieuws. Van XBOX tot Wii<description>
<language>nl</language>";
// SQL ophalen
$sql3 = "SELECT DISTINCT( p.`post_id` ), `p`.`bbcode_uid`, t.`topic_id`, t.`topic_time`, t.`forum_id`, t.`topic_title`, t.`topic_first_poster_name`, t.`topic_replies`, f.`forum_name`
FROM `Forum_topics` AS `t`, `Forum_posts` AS `p`, `Forum_forums` AS `f`
WHERE `t`.`topic_id` = `p`.`topic_id`
AND `t`.`forum_id` IN ('47', '48', '49', '50','57')
AND `t`.`topic_first_post_id` = `p`.`post_id`
AND `t`.`forum_id` = `f`.`forum_id`
GROUP BY (p.`topic_id`)
ORDER BY `p`.`topic_id` DESC";
$result = $db->sql_query_limit($sql3, 0,20);
while ($row = $db->sql_fetchrow($result))
$delete_forum = array("`","'","~","!","@","#","$","%","^","&","*","(",")","-","_","=","+","[","{","]","}",";",":","'","\"","\\","|",",","<",".",">","/","?");
$forum_seo['forum_name'] = str_replace($delete_forum, '', strtolower($row['forum_name']));
$forum_seo['forum_name'] = str_replace(' ', ' ', $forum_seo['forum_name']);
$forum_seo['forum_name'] = str_replace(' ', '-', $forum_seo['forum_name']);
$delete_topic = array("~","!","@","#","$","%","^","&","*","(",")","-","_","=","+","[","{","]","}",";",":","\"","\\","|",",","<",".",">","/","?");
$topic_seo['topic_title'] = str_replace($delete_topic, '', strtolower($row['topic_title']));
$topic_seo['topic_title'] = str_replace(array("`","'"), '-', $topic_seo['topic_title']);
$topic_seo['topic_title'] = str_replace(' ', ' ', $topic_seo['topic_title']);
$topic_seo['topic_title'] = str_replace(' ', '-', $topic_seo['topic_title']);
$row = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $row);
$row = str_replace("\n", "\n<br />\n", $row);
$time = date("d.m.Y H:i", $row['topic_time']);
$title = stripslashes( $row['topic_title'] );
{
$pubdate = ($time);
$url = "http://www.factscommunity.nl/" . $forum_seo['forum_name'] . "-f" . $row['forum_id'] . "/" . $topic_seo['topic_title'] . "-t" . $row['topic_id'] . ".html";
$titel = $row['topic_title'];
$description = $row['post_text'];
//RSS Printen voor twitterfeed.com met SEO URLS
echo "
<item>
<title>Nu op de site: <![CDATA[$titel]]></title>
<guid>$url</guid>
<coop:keyword><![CDATA[$titel]]></coop:keyword>
<link>$url</link>
<pubDate>$date +21600</pubDate>
<description><![CDATA[$description]]></description>
</item>";
}
echo "</channel>
</rss>";
?>
// We willen GEEN php, maar xml:
header ('Content-Type: text/xml');
// Verbinden met de database
define ('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forum_cms/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Errors voorkomen:
if(empty($_GET['feed']))
$feed = 'Geen berichten';
else
$feed = $_GET['feed'];
// Begin maken:
echo "<?xml version=\"1.0\" encoding=\"windows-1252\"?>
<rss version=\"2.0\" xmlns:coop=\"http://www.google.com/coop/namespace\">
<channel>
<title>Factscommunity.nl - Nieuws</title>
<link>http://www.factscommunity.nl/nieuws-f46/</link>
<description>Het laatste Gaming nieuws. Van XBOX tot Wii<description>
<language>nl</language>";
// SQL ophalen
$sql3 = "SELECT DISTINCT( p.`post_id` ), `p`.`bbcode_uid`, t.`topic_id`, t.`topic_time`, t.`forum_id`, t.`topic_title`, t.`topic_first_poster_name`, t.`topic_replies`, f.`forum_name`
FROM `Forum_topics` AS `t`, `Forum_posts` AS `p`, `Forum_forums` AS `f`
WHERE `t`.`topic_id` = `p`.`topic_id`
AND `t`.`forum_id` IN ('47', '48', '49', '50','57')
AND `t`.`topic_first_post_id` = `p`.`post_id`
AND `t`.`forum_id` = `f`.`forum_id`
GROUP BY (p.`topic_id`)
ORDER BY `p`.`topic_id` DESC";
$result = $db->sql_query_limit($sql3, 0,20);
while ($row = $db->sql_fetchrow($result))
$delete_forum = array("`","'","~","!","@","#","$","%","^","&","*","(",")","-","_","=","+","[","{","]","}",";",":","'","\"","\\","|",",","<",".",">","/","?");
$forum_seo['forum_name'] = str_replace($delete_forum, '', strtolower($row['forum_name']));
$forum_seo['forum_name'] = str_replace(' ', ' ', $forum_seo['forum_name']);
$forum_seo['forum_name'] = str_replace(' ', '-', $forum_seo['forum_name']);
$delete_topic = array("~","!","@","#","$","%","^","&","*","(",")","-","_","=","+","[","{","]","}",";",":","\"","\\","|",",","<",".",">","/","?");
$topic_seo['topic_title'] = str_replace($delete_topic, '', strtolower($row['topic_title']));
$topic_seo['topic_title'] = str_replace(array("`","'"), '-', $topic_seo['topic_title']);
$topic_seo['topic_title'] = str_replace(' ', ' ', $topic_seo['topic_title']);
$topic_seo['topic_title'] = str_replace(' ', '-', $topic_seo['topic_title']);
$row = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $row);
$row = str_replace("\n", "\n<br />\n", $row);
$time = date("d.m.Y H:i", $row['topic_time']);
$title = stripslashes( $row['topic_title'] );
{
$pubdate = ($time);
$url = "http://www.factscommunity.nl/" . $forum_seo['forum_name'] . "-f" . $row['forum_id'] . "/" . $topic_seo['topic_title'] . "-t" . $row['topic_id'] . ".html";
$titel = $row['topic_title'];
$description = $row['post_text'];
//RSS Printen voor twitterfeed.com met SEO URLS
echo "
<item>
<title>Nu op de site: <![CDATA[$titel]]></title>
<guid>$url</guid>
<coop:keyword><![CDATA[$titel]]></coop:keyword>
<link>$url</link>
<pubDate>$date +21600</pubDate>
<description><![CDATA[$description]]></description>
</item>";
}
echo "</channel>
</rss>";
?>
Gewijzigd op 23/11/2010 12:45:06 door Jeffrey van der Sluys
Er zijn nog geen reacties op dit bericht.