Jump to content

Converting my current RSS to include Sub Sections and a google Video Sitemap


Heath

Recommended Posts

I have been working on this one for a few weeks now, before that on and off and I have come to the conclusion I just don't understand php enough to get how to change this to get it working properly.

 

First - I was trying to add the ability to give each category in my media section its own RSS feed. I am not really sure if I am providing enough of the code, if I am not, please just let me know what else I need to include. (the code will be posted below). Currently the code allows for me to see the newest over all. I was trying to make it so it would be like media=rss=sectionID . Right now its just media=rss. This one has been boggling my mind for some time now.

 

Second, I wanted to also convert the code below to produce a proper google video sitemap. If this is possible could some one PLEASE explain it, I have been working on getting this one working for weeks now with no luck. It seems really simple to do, but apparently I just can't figure it out. So if any one could please explain how to do it I would be highly great full.  I really do not know much so I would really appreciate any one willing to help me with this as well as give me some little tips if possible in order to help me better understand how it works.

 

Here is the code I am trying to play with that creates my current RSS feed for my video section.

 

 

	function rss() {
	global $mkportals, $DB, $mklib;

	$content = "<?xml version='1.0' encoding='iso-8859-1'?>\n
<rss version='2.0'>
<channel>
<title>$mklib->sitename</title>
<link>$mklib->siteurl</link>
<description>MkMedia Generated</description>
<generator>MkMedia</generator>
<language>Multi-Lang</language>
<copyright>MkMedia 2004 - ".date("Y")."</copyright>";

	$query = $DB->query("SELECT id, name, description, data, author FROM mkp_media WHERE validate = '1' AND visible = '1' ORDER by `data` DESC LIMIT 0,10");
	if (!$DB->get_num_rows($query)) {
		$content .= "
<item>
<title>Sorry There Are Currently No Feeds</title>
<link></link>
<pubDate></pubDate>
<author></author>
<description></description>
</item>
</channel>
</rss>";
		$rsslength = strlen($content);
		header("Content-Type: text/xml");
		header("Content-Length: ".$rsslength);
		header("Cache-Control: no-cache");
		echo $content;
		exit;
	}
	while ($row = $DB->fetch_row($query)) {
		$id = $row['id'];
		$date = $mklib->create_date($row['data']);
		$name = str_replace("´", "", $row['name']);
		$name = preg_replace('/&(?!(#[0-9]+|[a-z]+);)/si', '&', $name);
		$description = str_replace("´", "", $row['description']);
		$description = preg_replace('/&(?!(#[0-9]+|[a-z]+);)/si', '&', $description);
		$author = $row['author'];
		$content .= "
<item>
<title>{$name}</title>
<link>$mklib->siteurl/index.php?ind=media&op=file_view&iden={$id}</link>
<pubDate>{$date}</pubDate>
<author>{$author}</author>
<description>{$description}</description>
</item>";

	}
	$content .= "
</channel>
</rss>";
	$rsslength = strlen($content);
	header("Content-Type: text/xml");
	header("Content-Length: ".$rsslength);
	header("Cache-Control: no-cache");
	echo $content;
	exit;
}

 

For the sitemap my goal is to replicate this.

http://www.google.com/support/webmasters/bin/answer.py?answer=80472&topic=10079

 

Again, any help would be highly appreciated, both of these issues are really annoying for me to accomplish.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.