Hi
i have a rss feed that i want to output like this in a php file so when i go to the say video.php
it will print this in the browser (without the commented bits)
<ratings>
<video file="
www.mysite/vids/11.flv"> // i'll add this manually for now in the php file
<title>funny Commercials - Ikea - </title> // $description = $results['description'];
<runtime>00:30</runtime> // i'll add this manually for now
<author>silent</author> // .$results[username].
<rating>5</rating> // I'll add maually for now in the php file
<views>20</views> // i'll add this manually for now in the php file
<key>aa6e02c990b0a82652dc<
/key> // .$results['vkey'];
<link>testtest</link> // $video =$config['BASE_URL']."/vie
w_video.ph
p?viewkey=
".$results
['vkey'];
</video>
<video file="10.flv">
<title>funny Commercials - Ikea - Balls</title>
<runtime>00:32</runtime>
<author>test</author>
<rating>5</rating>
<views>22</views>
<key>44259755d38e6d163e82<
/key>
<link>testtest</link>
</ratings>
I have been tring for sometime and having no look in making it work
below is the rss.php i am tring to convert to make it print out like above most of the info i need is there i'll add the bit maually till i find the
right tables for the other info
could someone help me try and make a sample if only to make the php print out the author and the title just as a guide to get me going
<?php
include("include/dbconfig.
php");
include("include/config.ph
p");
if ($_GET[type] == "new")
{
$query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.VID desc LIMIT 10";
$titel = "[20 Newest videos on ".$config['site_name']."]"
;
$url = $config['BASE_URL']."";
}
elseif ($_GET[type] == "views")
{
$query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.viewnumber desc LIMIT 10";
$titel = "[20 Most Viewed videos on ".$config['site_name']."]"
;
$url = $config['BASE_URL']."";
}
elseif ($_GET[type] == "comments")
{
$query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.com_num desc LIMIT 10";
$titel = "[20 Most Commented videos on ".$config['site_name']."]"
;
$url = $config['BASE_URL']."";
}
else
{
$query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.VID desc LIMIT 20";
$titel = "[20 Newest videos on ".$config['site_name']."]"
;
$url = $config['BASE_URL']."";
}
header("Content-Type: text/xml");
header("Expires: 0");
print "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
print "<!DOCTYPE rss >\n";
print "<rss version=\"2.0\" xmlns:prc=\"
http://purl.org/dc/elements/1.1\">
\n";
print "<channel>\n";
print "<title>".$config['site_na
me']."</ti
tle>\n";
print "<link>".$url."</link>\n";
print "<description>".$titel."</
descriptio
n>\n";
print "<copyright>Copyright (c) 2006-2007 by ".$config['site_name']." - All rights reserved.</copyright>\n";
print "<image>\n";
print "<url>".$config['BASE_URL'
]."/images
/11.jpg</u
rl>\n";
print "<title>".$config['site_na
me']."</ti
tle>\n";
print "<link>".$config['BASE_URL
']."</link
>\n";
print "</image>\n";
$db=mysql_connect ($DBHOST,$DBUSER,$DBPASSWO
RD) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($DBNAME);
$num_rows = mysql_num_rows(mysql_query
("select * from media"));
$result = mysql_query($query) or die ('Query Error: ' . mysql_error());
while ($results = mysql_fetch_array($result)
)
{
$photo = $config['BASE_URL']."/thum
b/1_".$res
ults['VID'
].".jpg";
$video = $config['BASE_URL']."/view
_video.php
?viewkey="
.$results[
'vkey'];
$description = $results['description'];
$description = str_replace ("&","",htmlspecialchar
s(stripsla
shes($desc
ription)))
;
$photo = str_replace ("&","&",htmlspecial
chars(stri
pslashes($
photo)));
print "<item>\n";
print " <title>".$results['title']
."</title>
\n";
print " <description>\n";
print " <![CDATA[";
print "<img src=\"$photo\" align=\"right\" border=\"0\" width=\"174\" height=\"130\" vspace=\"4\" hspace=\"4\" />
".$description."</p>
".$key."</p>
Added by: <a href=\"$config[BASE_URL]/u
profile.ph
p?UID=".$r
esults[UID
]."\">".$r
esults[use
rname]."</
a>
Tags: ";
$tok = strtok($results[keyword], " ");
while ($tok !== false)
{
print "<a href=\"$config[BASE_URL]/s
earch_resu
lt.php?sea
rch_id=".$
tok."\">".
$tok."</a>
";
$tok = strtok(" ");
}
print "
Date: ".$results[adddate]."
</p>
<hr>";
print " ]]>\n";
print " </description>\n";
print "</item>\n";
}
mysql_close();
print "</channel>";
print "</rss>";
?>
regards
pete