Truenash Posted July 9, 2008 Share Posted July 9, 2008 I run a php-Fusion Content Management system on www.community.blackvine-animation.co.uk, and wanted the news from that to be displayed on my main site: www.blackvine-animation.co.uk. I successfully did this yesterday, however, I still need to get the time and date of posting, the username of postee and the link to comment the news at www.community.blackvine-animation.co.uk there. The most important one of these I think is the Username. There is I think 3 different parts to this. The table fusion_users contains users_id, which is the same as news_name contained in the table fusion_news. user_id decides user_name. I need to make news_name equal user_id then get user_id to equal the correct user_name, but have no idea how, then I need to print this at the bottom of the news post using php. I understand roughly what I'm doing, as I have used PHP and MySQL a little, but I'm still very lost here! Sorry if this is in the wrong section. I've looked for help for this everywhere, and am new to this forum, and you guys all seem to be nice and know what you're doing, so I thought I'd ask here! Thanks Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted July 10, 2008 Share Posted July 10, 2008 Does php-Fusion create rss feeds? If so, that would be the way to go. Quote Link to comment Share on other sites More sharing options...
Truenash Posted July 10, 2008 Author Share Posted July 10, 2008 I think there is a mod which creates RSS feeds, but I'm not too sure how stable it is. The latest version of fusion is released soon so developers have abandoned their old mods for new ones. Quote Link to comment Share on other sites More sharing options...
Truenash Posted July 10, 2008 Author Share Posted July 10, 2008 Right okay, www.community.blackvine-animation.co.uk should now be set up for rss feeds for news.php. Now how do I make www.blackvine-animation.co.uk display these feeds as html? Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted July 10, 2008 Share Posted July 10, 2008 You can use a parser such as SimplePie or make your own using SimpleXML. Quote Link to comment Share on other sites More sharing options...
Truenash Posted July 11, 2008 Author Share Posted July 11, 2008 Well to be honest it seems simpler doing it the way I've done it. I'm trying to avoid using third party stuff on the main site, and wanted to code as much of it as I could myself. And learning simpleXML to code this myself is going to be awkward, and I can't find a decent tutorial. What I've done to get the news on www.blackvine-animation.co.uk from www.community.blackvine-animation.co.uk is this: <?php include 'config.php'; include 'opendb.php'; $query = "SELECT news_subject FROM fusion_news ORDER BY news_datestamp DESC LIMIT 0,10"; $result = mysql_query($query); if($row = mysql_fetch_array($result, MYSQL_ASSOC)) $subjects = nl2br("{$row['news_subject']}<br>" ); echo stripslashes($subjects); ?> </div> <div id="imageplace"></div> <p> <?php include 'config.php'; include 'opendb.php'; $query = "SELECT * FROM fusion_news ORDER BY news_datestamp DESC LIMIT 0,10"; $result = mysql_query($query); if($row = mysql_fetch_array($result, MYSQL_ASSOC)) $news = nl2br("{$row['news_news']} <br>") . nl2br("{$row['news_extended']} <br><br>"); { echo stripslashes($news); } include 'closedb.php'; ?> That just takes the news and subject from the database entry that php-fusion makes when news is entered via the form on there. What I want is to get the user name on there aswell. In the fusion_news table, it identifies the user who made the post by news_name, which is entered as a numeric value. In the table fusion_users, there is user_name and user_id. User_name is there name in text, user_id is numeric value. I need to make it take the news_name numeric value, then make that equal user_id, then make that find the user_name, but don't know how. Any idea how to do this? Even just pointing me in the right direction as in like a name of a function or something that I can research and learn myself would be great. Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted July 11, 2008 Share Posted July 11, 2008 In the table fusion_users, there is user_name and user_id. User_name is there name in text, user_id is numeric value. I need to make it take the news_name numeric value, then make that equal user_id, then make that find the user_name, but don't know how. Any idea how to do this? Even just pointing me in the right direction as in like a name of a function or something that I can research and learn myself would be great. Have a look at the tutorial recently posted on phpFreaks: http://www.phpfreaks.com/tutorial/data-joins-unions Also, for future reference, SimpleXML is a part of php. It's not 3rd party, and, as the name implies, it's simple. $rss_file = @file_get_contents($cache_file) or die ("Data not available"); $rss = new SimpleXMLElement($rss_file); foreach ($rss->channel->item as $item) { echo "<a href='{$item->link}'>$item->title</a><br>{$item->data}"; } Quote Link to comment Share on other sites More sharing options...
Truenash Posted July 13, 2008 Author Share Posted July 13, 2008 Yeah I know it's part of PHP, but by third party scripts I mean things other people had wrote, like simplepie. Also, thanks for the link and the code exerpt! Ah :-\ the RSS mod I used to set up the feed for the news doesn't display username, so I've got to do it the way I have anyway. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.