Sorry guys and gals,
I have serached the forums over the last few days - I hate asking questions that have been asked a dozen times before but I cant seem to find the solution.
I am trying to get an RSS feed into a block, I have chose the correct RSS block to add to my page, and as far as I am aware the feed is good, I have also tried other feeds that I have seen advertised on this site that senior member have checked and OK`d
Heres the feed code im using: http://www.armed-assault-zone.com/feeds/news.php
is there any chance someone could try it in a block and tell me if it works for them please?
It may be my installation or something as I cant get the banner to change when I use the Logo image URL: option in Theme Options and Preferences section.
Of course by searching here I found the info on how to change it by adding html code. I also sussed out (by searching here) how to change the page title to an image.
The RSS feed prob has me baffled though :idiot2:
Thanks in advance for any help..
I just tried it, it seems to working ok but its very long, using the Millenium theme btw
Oh and I have to scroll sideways a bit to see it all
I have it in center block and turned it show titles only works fine.
Click on my sig to see it, but it will be gone soon :)
Cheers Lesmond, so the feed works OK.
Must be doing something wrong at my end :tickedoff:
Any ideas anyone?
Quote from: [JB] on October 24, 2006, 12:35:07 AM
Cheers Lesmond, so the feed works OK.
Must be doing something wrong at my end :tickedoff:
Any ideas anyone?
It also comes up fine for me (tried it in an RSS center-block).
For your banner issue, you may want to try this (http://www.tinyportal.net/smf/index.php?topic=9670.msg82787#msg82787).
Cheers for the feedback.
@fb - I got the banner sorted mate -just couldnt use the function in the admin panel to do it.
I will give the RSS feed a go in a center block, but I can see by lesmond`s site that it should work in a left or right block.
*EDIT*
I tried center as well as left and right block - no joy
there is only one thing for it... :knuppel2:
..I will have to look at alternate methods or bin the RSS feeds.
Thanks for your help on this ppl ;)
Do you already have another RSS feed?
My experience is that you can only have one feed from the function in TP, if you want more you will need to copy and rename the function, then add the feed url as the $backend.
In TPortal.php
Find
function get_perm($perm)
Add before (this one is for Major Geeks, adapt it to suit)
// RSS feed from Major Geeks
function RSSMajorG()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
Ã, Ã, $context['TPortal']['rss'];
$backend =Ã, 'http://www.majorgeeks.com/backend.php?id=120';
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$curl = "";
// Now to the parsing itself. Starts by creating it:
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
// Open the actual datafile:
$fp = fopen($backend, "r");
// Run through it line by line and parse:
while ($data = fread($fp, 4096))
{
xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
// Close the datafile
fclose($fp);
// Free any memmory used
xml_parser_free($xml_parser);
}
This must be unique
RSSMajorG()
So if you want to have multiple RSS feeds available each must have a different name.
This you must change for each feed source
$backend =Ã, 'http://www.majorgeeks.com/backend.php?id=120';
In a PHP block or Article use the following code, changing the function name, in this caseÃ, RSSMajorG(), to whatever you have called your function.
global $context, $settings, $options, $scripturl, $txt, $modSettings;
Ã, Ã, Ã, Ã, echo '<div style="padding: 5px;" class="smalltext">';
Ã, Ã, Ã, Ã, RSSMajorG();
Ã, Ã, Ã, Ã, echo '</div>';
When TP is updated these will be removed because the file will be overwritten. To replace them, to do this find the function TPparseRSS() in the updated TPortal.php file, copy it as above and add you own function name and $backend to each feed function required.
Thanks nokonium, that was quite an explanatory post but unfortunately I dont have any other feeds atm- this is the only one.
Once I do get it working I will probably be looking to add more so your info will be very useful, thanks.
Try it anyway then and see if it works, I have 3 working on my main site.
u guys should get the flash RSS feed displayer from tufat.com
its only 5 bucks and u get 5 of them and its awesome!
Quote from: nokonium on October 24, 2006, 07:13:18 AM
In TPortal.php
Find
function get_perm($perm)
Used find option in Dreamweaver and also did a quick search with the mk1 eyeball - couldnt find that line?
It has been there for the whole of 0.9x series and I can find it OK with Dreamweaver, the line number may vary but it is there.
I am refering to Sources/TPortal.php
Dreamweaver search not giving any results at all.
I will go through the code line by line and look for it.
I`ll let you know the results.
Thanks for your help so far :)
Right, firstly im an idiot - I found the line you mentioned. I was searching for the code with `text` highlighted rather than `code` - my appologies.
It still didnt work though, I even used your exact code for majorgeeks feeds and it still didnt work.
The rss icon does appear in the adress bar on firefox though.
I'm baffled, I have that working as an article and as a block, I have set it up as a centre block viewable by guests on my Cat and Fiddler test site, (the article has been turned off for now). OK that is TP 0.96b but a custom function should still work.
I've also just copied and pasted the code from earlier in this thread into a 0.95 (revised) TPortal.php and that works as well.
I'm beginning to think that is isn't TP related (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnokonium.co.uk%2Fmr_black_cat_2%2Funsorted%2Fthinking3.gif&hash=4aa6ab2ff7b6fb75fda8f3b06854c9649d07896f)
Quote from: nokonium on October 26, 2006, 07:42:06 AM
I'm beginning to think that is isn't TP related (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fnokonium.co.uk%2Fmr_black_cat_2%2Funsorted%2Fthinking3.gif&hash=4aa6ab2ff7b6fb75fda8f3b06854c9649d07896f)
Good point, Is there an option that could be turned off/on in SMF/TP that could not have been activated by me?
RSS feeds work OK as a rule on my PC, I even admin a board that I implemted the exact same rss feed but its on a mambo cms and it works fine.
I find it is strange that others can get this RSS working by pasting straight into the rss blck and I cant.
Maybe I am thicker than my wife says I am :o
Im currently using the same code in an articel on my site to display a RSS feed, however, some information is missing once it is parsed. There is a line labeled <pubDate> which displays the date of posting. I would like to show up in the feed, however, I can't figure out how to change the code to enable it to read this tag from the RSS and show it on my site.
Any ideas? I've attempted to do the following with no luck:
global $context, $settings, $options, $scripturl, $txt, $modSettings;
$backend = 'http://wowvault.ign.com/show_rss.php';
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$pubDate = "";
$link = "";
Obvisouly adding PubDate didn't make any difference at all. Any help would be appreciated.
Cheers O0
I have found an error in the code I pasted on page 1, it has a line that shouldn't be there, it gives an 'undefined' error.
Remove
Ã, Ã, $context['TPortal']['rss'];
That should only be in the TPparseRSS function
Removed that line but its still not working.
confirm that original code you posted must be before the `function get_perm($perm)` code
I don't think it is a MUST but by putting it there it will follow function TPparseRSS() and you will have the RSS parsing functions grouped together.
I have this RSS Reader to grab news from whichever site you choose, but I cant remember where it came from, I have it in a center block, I have added your feed to the code give it a try, oh and it wasn't working before but JP fixed it for me :)
// An RSS Reader to grab news from whichever site you choose
$backend = "http://www.armed-assault-zone.com/feeds/news.php"; //change this to match the rss feed url you wish to display.
// end
function endtheElement($parser, $tagName) {
// This function is used when an end-tag is encountered.
global $insideitem, $tag, $title, $description, $link;
if ($tagName == "ITEM") {
echo '<table width="100%" border="0"><tr>
<td class="main-table">
<span class="nav-head"><strong>
';
printf("<p><b><a href='%s'>%s</a></b></p>", // make our title into an actual link
trim($link),htmlspecialchars(trim($title))); // remove html characters from the title
echo "</tr>";
echo '<tr>
<td class="nav">';
printf("<p>%s</p>",$description); // Print out the live journal entry
echo"</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
$title = $description = $link = $insideitem = false;
}
}
// Now to the parsing itself. Starts by creating it:
$xml_parser = xml_parser_create();
// Then setup the handlers:
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
// Open the actual datafile:
$fp = fopen($backend, r);
// Run through it line by line and parse:
while ($data = fread($fp, 4096)) {
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
// Close the datafile
fclose($fp);
// Free any memmory used
xml_parser_free($xml_parser);
Thanks lesmond,
I tried that and it doesnt work for me :(
It has to be something else thats causing the probelm at my end - I just dont know what it could be??