Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2004, 11:19 PM
MikeeX MikeeX is offline
 
Join Date: Oct 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Creating my own page w/ RSS. Need help

Hello everyone! Hopefully I'm in the right forum

What I'm trying to do is setup my own vb powered page with RSS feeds on it. Now I created my php file and the template. You can view it here:

http://forums.winforums.org/technews.php

I'm using Magpie to parse the RSS. Now I have a file called technewsdata.php which is called from a varible in my phpinclude_start template.

technewsdata.php
PHP Code:
<?

require_once 'rss_fetch.inc';

$url = 'http://rssnewsapps.ziffdavis.com/tech.xml';
$rss = fetch_rss($url);

echo "Site: ", $rss->channel['title'], "<br>\n";
foreach ($rss->items as $item ) {
    $title = $item[title];
    $url   = $item[link];
    echo "<a href=$url>$title</a></li><br>\n";
}

?>
As you can see, this works perfect (check out link posted above). Now, I want to add about 5-10 more RSS feeds like this to the same page. Now I don't know PHP at all, so I'm not sure how to accomplish this. How can I use the ONE technewsdata.php file for all my RSS feeds? Is it called an array? That's where I'm hoping you guys could help me. So I don't have to create say, technewsdata_slashdot.php, with the same parse information above. I want to utilize one php file.

I hope this makes sense, and if not let me know what else you need from me.

Any help or information on this would be greatly appreciated!
Reply With Quote
  #2  
Old 12-11-2004, 11:23 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there some nice php rss tutorials out there, you can look in the external.php file for ideas and also on google
Reply With Quote
  #3  
Old 12-11-2004, 11:25 PM
MikeeX MikeeX is offline
 
Join Date: Oct 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

external.php would be used if I wanted to use to create my own RSS correct? I'm asking pretty much how can I use php code all in one file, w/ multiple RSS feeds added to it.

Or...am I missing something?
Reply With Quote
  #4  
Old 03-08-2005, 02:52 PM
MikeeX MikeeX is offline
 
Join Date: Oct 2003
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thought I would post what I did. Just in case others are interested

PHP Code:
<?

require_once 'rss_fetch.inc';

// Section 1

echo '<table cellspacing="7" cellpadding="7" width="100%">';

// RSS 1

$url1 = 'URL TO RSS';
$num_items1 = 7;
$rss1 = fetch_rss($url1);

if ( $rss1 ) {

}
else {
   echo "Error reading news feed  " .
        "Check back later" .
        "<br>Error Message: " . magpie_error();
}

echo '<tr>';
echo '<td valign="top">';
echo "&nbsp;&nbsp;Source: <b>", $rss1->channel['title'], "</b><p>\n";
$items1 = array_slice($rss1->items, 0, $num_items1);
foreach ( $items1 as $item1 ) {
    $title1 = substr($item1[title], 0, 50);
        //$title1 = $item1[title];
        $url1   = $item1[link];
    echo "? <a href=$url1>$title1</a></li><br>\n";
}
echo '</td>';
echo '<td valign="top">';

// RSS 2

$url2 = 'URL TO RSS';
$num_items2 = 7;
$rss2 = fetch_rss($url2);

if ( $rss2 ) {

}
else {
   echo "Error reading news feed  " .
        "Check back later" .
        "<br>Error Message: " . magpie_error();
}


echo "&nbsp;&nbsp;Source: <b>", $rss2->channel['title'], "</b><p>\n";
$items2 = array_slice($rss2->items, 0, $num_items2);
foreach ( $items2 as $item2 ) {
    $title2 = substr($item2[title], 0, 50);
        //$title2 = $item2[title];
    $url2   = $item2[link];
    echo "? <a href=$url2>$title2</a></li><br>\n";
}
echo '</td>';
echo '</tr>';
echo '</table>';

// Section 2

echo '<table cellspacing="7" cellpadding="7" width="100%">';

// RSS 3

$url3 = ' URL TO RSS';
$num_items3 = 7;
$rss3 = fetch_rss($url3);

if ( $rss3 ) {

}
else {
   echo "Error reading news feed  " .
        "Check back later" .
        "<br>Error Message: " . magpie_error();
}

echo '<tr>';
echo '<td valign="top">';
echo "&nbsp;&nbsp;Source: <b>", $rss3->channel['title'], "</b><p>\n";
$items3 = array_slice($rss3->items, 0, $num_items3);
foreach ( $items3 as $item3 ) {
    $title3 = substr($item3[title], 0, 50);
        //$title3 = $item3[title];
    $url3   = $item3[link];
    echo "? <a href=$url3>$title3</a></li><br>\n";
}
echo '</td>';
echo '<td valign="top">';

// RSS 4

$url4 = 'URL TO RSS';
$num_items4 = 7;
$rss4 = fetch_rss($url4);

if ( $rss4 ) {

}
else {
   echo "Error reading news feed  " .
        "Check back later" .
        "<br>Error Message: " . magpie_error();
}


echo "&nbsp;&nbsp;Source: <b>", $rss4->channel['title'], "</b><p>\n";
$items4 = array_slice($rss4->items, 0, $num_items4);
foreach ( $items4 as $item4 ) {
    $title4 = substr($item4[title], 0, 50);
        //$title4 = $item4[title];
    $url4   = $item4[link];
    echo "? <a href=$url4>$title4</a></li><br>\n";
}
echo '</td>';
echo '</tr>';
echo '</table>';

?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:54 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.15637 seconds
  • Memory Usage 2,206KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete