Recent Topics

1 Dec 15, 2006 12:36    

Hi ,

Is it possible to have all the output from DB for posts, comments, trackbacks, pingbacks & also all pages output in xml.

I do not want to use the RSS for XML generation.

What I would ideally like is $Item should return all array values in xml for each and every page of the blog.

Is that possible in version 1.8.5

I would like something like this to be output from the functions in the blog.

<?php
	$db_name = "b2evolution";
	$connection = mysql_connect('localhost', "demouser", "demopass") else Could not connect.
	$table_name = 'evo_blogs';
	$db = mysql_select_db($db_name);
	$query = "SELECT * FROM " . $table_name;
	$result = mysql_query($query) or die("Could not complete database query");
	$num = mysql_num_rows($result);
	if ($num != 0) 
	{
		$file = fopen("results.xml", "w");
		$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
		$_xml .="<blogs>\r\n";

		while ($row = mysql_fetch_array($result)) 
		{
			$_xml .="\t<blog title=\"" . $row["title"] . "\">\r\n";
				$_xml .="\t\t<author>" . $row["author</isbn>\r\n";
				$_xml .="\t\t<category>" . $row["category"] . "</category>\r\n";
				$_xml .="\t\t<publisher code=\"" . $row["publishercode"] . "\">" . $row["publisher"] . "</publisher>\r\n";
				$_xml .="\t\t<authors>\r\n";
					$_xml .="\t\t\t<name>" . $row["authorsname1"] . "</name>\r\n";
					$_xml .="\t\t\t<name>" . $row["authorsname2"] . "</name>\r\n";
				$_xml .="\t\t</authors>\r\n";
				
				$_xml .="\t</blog>\r\n"; 
		}

		$_xml .="</blogs>";
		fwrite($file, $_xml);
		fclose($file);
		echo "XML has been written.  <a href=\"results.xml\">View the XML.</a>";
	} 
	else 
	{
		echo "No Records found";
	} 
?>

3 Dec 15, 2006 13:33

Thanks ... so i can use &posts=99999999 to get the output for posts in xml format.

Regards,
Prashant

4 Dec 15, 2006 13:37

&blog=1 as well ( this is the "all blog" it contains every blogs posts)

¥

5 Dec 15, 2006 13:45

got u .. thanks very much.


Form is loading...