PDA

View Full Version : [Module] Customizable RSS feed module


Pages : 1 2 [3] 4 5 6 7 8 9 10 11 12 13

D1mmmka
01-23-2006, 12:33 PM
Hi Tom
I've installed a module as it is said but nothing happend.
The module is marked as active.
my rss is http://informer.gismeteo.ru/rss/27612.xml
but I've tried http://cyber.law.harvard.edu/blogs/gems/tech/rss2sample.xml and the result was the same.
My server is on the win2003 platform (apache 2.0 +php5)
cache dir is
C:\Inetpub\wwwroot\forum\cache
and the should not be any problems with the rights, everyone have full permissions.
There is no files in cache dir...

what's the matter? has anybody installed this module on windows platform?

Tom M
01-23-2006, 12:54 PM
what's the matter? has anybody installed this module on windows platform?That's a good question.

I did check the feed and it worked OK on my site so that's not it. If you aren't getting any error messages and the feeds not showing up in the cache then I'll need to think a bit about it. In my case I'd just add some diagnostic print statements to the php module to see what's happening - hint, hint.

Our Sponsors
 

D1mmmka
01-23-2006, 01:21 PM
I'd just add some diagnostic print statements to the php module to see what's happening - hint, hint.

it'd be nice :)
another question: should I "Use Module Shell Template"? but I think that it is no difference before some cache would be in it's dir...

Tom M
01-23-2006, 01:25 PM
should I "Use Module Shell Template"? but I think that it is no difference before some cache would be in it's dir...No, you don't want to use Module Shell Template. Yes, if the module is working then you *should* see something in the chaceh directory - or some sort of an error message.

Our Sponsors
 

D1mmmka
01-23-2006, 01:46 PM
"Update All Pages
Set this option to 'Yes' if you would like to update all of your pages to include this module. Otherwise, you will need to manually edit each page that you would like the module to appear on."
did I need to check on this option during the instalation?
there is no errors and no files in the cache...
the address of my portal is www.lika.mine.nu:980/index.php

Tom M
01-23-2006, 01:53 PM
did I need to check on this option during the instalation?The answer is "It depends". I tend to leave that at 'No' because I rarely want a module on all my pages, but then it's necessary to go in and manually update each page you want the module to appear on.

Activation is really comprised of 2 steps.

1. setting the module to 'Active'.
2. checking the module on each page you want it to display on.

D1mmmka
01-23-2006, 02:05 PM
2. checking the module on each page you want it to display on.

what does it mean? explain me please :)
what I need to display this module in index.php?

D1mmmka
01-23-2006, 02:09 PM
here are all my preferences... what's wrong?

Tom M
01-23-2006, 02:13 PM
What modules are enabled on your Home Page (or whatever page you and the RSS feed on)?

D1mmmka
01-23-2006, 02:18 PM
oh... I've understood :)
but now I've got a real traubles with encording... can this module support cp-1251?

Tom M
01-23-2006, 03:53 PM
oh... I've understood :)
but now I've got a real traubles with encording... can this module support cp-1251?I've done some looking and haven't had any luck in solving the problem yet... so for now the answer appears to be 'no'.

D1mmmka
01-23-2006, 04:29 PM
I've done some looking and haven't had any luck in solving the problem yet... so for now the answer appears to be 'no'.
this is very strange... because all other (original) modules support my encording and only this appear text in utf-8...
very is the feed reencording to utf-8? my rss has win-1251 encording..

Tom M
01-23-2006, 05:04 PM
The problem, as far as I can tell, is that the xml_parse function only supports utf-8, ISO-8859-1 and US-ASCII. I tried doing a convert from 1251 to utf-8 priot to the parsing and that didn't work. I might be able to get it working but unforunately I don't have time to invest in it at the moment.

D1mmmka
01-23-2006, 05:19 PM
I'm not a pro in php... I think the text must be converted from utf8 to win1251 after xml_parse function... look at functions.php...

pennylessz28
01-23-2006, 05:20 PM
Nice work Tom.

Tom M
01-23-2006, 07:52 PM
I'm not a pro in php... I think the text must be converted from utf8 to win1251 after xml_parse function... look at functions.php...No, the conversion definitely has to be from 1251 to utf8, though it looks like I may have solved it - and w/o a source code modification :D :D :D

Edit the RSS module and skip down to the Data modification mode section. In that area paste the following.
if(!function_exists('win1251utf8'))
{
function win1251utf8($sInput)
{
$sOutput = '';
for ( $i = 0; $i < strlen( $sInput ); $i++ )
{
$iAscii = ord( $sInput[$i] );
if ( $iAscii >= 192 && $iAscii <= 255 ) $sOutput .= '&#'.( 1040 + ( $iAscii - 192 ) ).';';
else if ( $iAscii == 168 ) $sOutput .= '&#'.( 1025 ).';';
else if ( $iAscii == 184 ) $sOutput .= '&#'.( 1105 ).';';
else $sOutput .= $sInput[$i];
}
return $sOutput;
}
}

$rss_item['TITLE'] = win1251utf8($rss_item['TITLE']);
$rss_item['CATEGORY'] = win1251utf8($rss_item['CATEGORY']);
$rss_item['DESCRIPTION'] = win1251utf8($rss_item['DESCRIPTION']);
$rss_channel['TITLE'] = win1251utf8($rss_channel['TITLE']);
$rss_channel['LINK'] = win1251utf8($rss_channel['LINK']);
I'm pretty sure it works based on looking at the feed directly in IE and the text this generates.

BTW - The code can be moved into the module directly if you like and need a bit better performance. However it's not needed in order for it to run properly.

Belicoso_Fino
01-23-2006, 11:17 PM
Whenever I try to upload the module, I get...

The file you have uploaded is not a valid module file.

This is not the first module that has done this.

I'm not using Linux/Apache...I'm Win2003Svr/ISS (don't laugh).

Any idea why the module won't upload?

:(

Tom M
01-23-2006, 11:46 PM
Any idea why the module won't upload?Not really. So long as you downloaded the module from the 1st post to your PC and then uploaded that using the CMPS Download / Upload Module capability things should be working fine.

If you have the same problem with other modules then it would seem to indicate either a configuration problem or some other error.

Belicoso_Fino
01-24-2006, 07:46 AM
Tom, can I just get the PHP code so I can plug it directly into a template?

This is not the first time this has happened, but I'm at a total loss to understand why this is happeneing.

Tom M
01-24-2006, 10:55 AM
Tom, can I just get the PHP code so I can plug it directly into a template?Since there are both template and the php code what you're asking isn't that easy. It sounds to me like you'd be better off resolving the problem you're having at present as that's a long term solution and it's always better to correct problems than to work around them given the opportunity.

If you'd like me to look at things, and install the module in the process, PM me with login info and I'll be happy to do it.

Belicoso_Fino
01-24-2006, 12:06 PM
PM Sent

D1mmmka
01-24-2006, 03:41 PM
No, the conversion definitely has to be from 1251 to utf8, though it looks like I may have solved it - and w/o a source code modification :D :D :D

Edit the RSS module and skip down to the Data modification mode section. In that area paste the following.
if(!function_exists('win1251utf8'))
{
function win1251utf8($sInput)
{
$sOutput = '';
for ( $i = 0; $i < strlen( $sInput ); $i++ )
{
$iAscii = ord( $sInput[$i] );
if ( $iAscii >= 192 && $iAscii <= 255 ) $sOutput .= '&#'.( 1040 + ( $iAscii - 192 ) ).';';
else if ( $iAscii == 168 ) $sOutput .= '&#'.( 1025 ).';';
else if ( $iAscii == 184 ) $sOutput .= '&#'.( 1105 ).';';
else $sOutput .= $sInput[$i];
}
return $sOutput;
}
}

$rss_item['TITLE'] = win1251utf8($rss_item['TITLE']);
$rss_item['CATEGORY'] = win1251utf8($rss_item['CATEGORY']);
$rss_item['DESCRIPTION'] = win1251utf8($rss_item['DESCRIPTION']);
$rss_channel['TITLE'] = win1251utf8($rss_channel['TITLE']);
$rss_channel['LINK'] = win1251utf8($rss_channel['LINK']);
I'm pretty sure it works based on looking at the feed directly in IE and the text this generates.

BTW - The code can be moved into the module directly if you like and need a bit better performance. However it's not needed in order for it to run properly.

I'll explain you... the charset of my forum is 1251... and the charset of the rss sourse is 1251 too. the problem is that xml_parse convert any source code to utf8, but I need the 1251 output encording... look http://php.rinet.ru/manual/ru/function.xml-parser-create.php
So the text after parsing must be converted to 1251..

Tom M
01-24-2006, 03:50 PM
I'll explain you... the charset of my forum is 1251... and the charset of the rss sourse is 1251 too. the problem is that xml_parse convert any source code to utf8, but I need the 1251 output encording... look http://php.rinet.ru/manual/ru/function.xml-parser-create.php
So the text after parsing must be converted to 1251..The real question is whether or not installing the mod in the Data modification code section solves the problem. What code set to/from becomes irrelevant if it worked ;). As I said, it looked right to me but then I don't read that language.

D1mmmka
01-24-2006, 04:40 PM
I can only say that this script doesn't solve my problem :) why... I'm trying to understand. With this script I can't see module in any ancording but w/o it I can with utf-8... but in this case I can't recognise all other text on the page cause it is in windows-1251

D1mmmka
01-24-2006, 04:58 PM
again gogle :)
may be iconv is the decision... check it plz )

Tom M
01-24-2006, 05:07 PM
I'm not able to progress any further then. That code on my system results in this output. If it's related to the code you page is in then I probably won't be able to solve the problem for you. The resulting out is converted from 1251 to utf-8 after the xml-parse functions. However that shouldn't matter as the xml tags are only 8-bit so the decode properly.

The only other solution is to modify the source to manipulate the data in a different spot. Hopefully you now have enough insight in order to do that.

again gogle :)
may be iconv is the decision... check it plz )I don't have iconv as part of my server and so a generic solution is needed as all systems don't have that loaded.

D1mmmka
01-24-2006, 05:39 PM
now it's okey :)
$rss_item['TITLE'] = iconv("UTF-8", "Windows-1251", $rss_item['TITLE']);
$rss_item['CATEGORY'] = iconv("UTF-8", "Windows-1251",$rss_item['CATEGORY']);
$rss_item['DESCRIPTION'] = iconv("UTF-8", "Windows-1251",$rss_item['DESCRIPTION']);
$rss_channel['TITLE'] = iconv("UTF-8", "Windows-1251",$rss_channel['TITLE']);
$rss_channel['LINK'] = iconv("UTF-8", "Windows-1251",$rss_channel['LINK']);

D1mmmka
01-24-2006, 05:54 PM
Does your module support images?

Tom M
01-24-2006, 06:35 PM
Does your module support images?Glad you got it working.

The image tag for the channel is converted but the templates don't use it. However it is available to you if you want to modify the template.

Belicoso_Fino
01-26-2006, 03:06 PM
Opened a ticket with Brian.

Still not up :(

interfx
01-27-2006, 08:24 PM
I just installed, the module is "active" but absolutely nothing is showing up... Am I missign something basic???

Thanks in advance...

Tom M
01-27-2006, 09:08 PM
I just installed, the module is "active" but absolutely nothing is showing up... Am I missign something basic???What feed are you using? Does the directory contain a copy of the cached feed?

ga2000gt
01-29-2006, 02:08 AM
I was just wondering, how hard would it be to make a dropdown menu in the feeds module so that people could pick a feed based on what subject matter they wanted. I use a feed from ABCNEWS.com and they have tons of different catergories for different feeds. Is there a way to make it so that the user can choose which catergory they would like to see the feed for? Or, easily change between feeds from other places from a dropdown menu in the module? Just curious, but I think this would be handy since some people want sports, some news, some computer related.

Tom M
01-29-2006, 10:33 AM
I was just wondering, how hard would it be to make a dropdown menu in the feeds module so that people could pick a feed based on what subject matter they wanted. I use a feed from ABCNEWS.com and they have tons of different catergories for different feeds. Is there a way to make it so that the user can choose which catergory they would like to see the feed for? Or, easily change between feeds from other places from a dropdown menu in the module? Just curious, but I think this would be handy since some people want sports, some news, some computer related.Anything is possible of course however it would be a fair sized overhaul from the way things are currently done.

You might want to take a look at this thread to see if it's more in line with what you're looking for. The only downside to that implementation that I see is that it's not a standalone install, meaning Carp or some other RSS processor needs to be installed separately. I also don't know if it remembers the last feed the user was on. If it always opens to a default feed instead of what the user last selected then that may not work for you.

ga2000gt
01-29-2006, 12:48 PM
I was wondering if I could use this code from a scoreboard mod I found. I edited it to link to all the feeds instead of the scoreboards but haven't added it. But it seemed like the same concept. Can I add it to the RSS Mod, if so, would I add it to the rss or rssbits template? Or would it even work?

<SCRIPT type="text/javascript" >
function leapto(form) {
var myindex=form.dest.selectedIndex
parent.CONTENT.location.href=(form.dest.options[myindex].value);
}
</SCRIPT>
<tr><td><center><FORM NAME="myform">
<SELECT NAME="dest" SIZE=1 onChange="leapto(this.form)">
<option value="http://my.abcnews.go.com/rsspublic/fp_rss20.xml" selected>Top Stories</option>
<option value="http://my.abcnews.go.com/rsspublic/world_rss20.xml">World Headlines</option>
<option value="http://my.abcnews.go.com/rsspublic/us_rss20.xml">US Headlines</option>
<option value="http://my.abcnews.go.com/rsspublic/politics_rss20.xml">Politics</option>
<option value="http://my.abcnews.go.com/rsspublic/scitech_rss20.xml">Technology</option>
<option value="http://my.abcnews.go.com/rsspublic/health_rss20.xml">Health</option>
<option value="http://my.abcnews.go.com/rsspublic/entertainment_rss20.xml">Entertainment</option>
<option value="http://my.abcnews.go.com/rsspublic/sports_rss20.xml">ESPN Sports</option>
<option value="http://my.abcnews.go.com/rsspublic/2020_rss20.xml">20/20 Headlines</option>
<option value="http://my.abcnews.go.com/rsspublic/wnt_rss20.xml">World News Tonight</option>
<option value="http://my.abcnews.go.com/rsspublic/travel_rss20.xml">Travel</option>
</SELECT>
</FORM>
<iframe width="165" height="220" name="CONTENT" scrolling="auto" marginwidth="1" marginheight="1" frameborder="0" src="http://my.abcnews.go.com/rsspublic/fp_rss20.xml">
</iframe></center></td></tr>

Tom M
01-29-2006, 01:09 PM
Can I add it to the RSS Mod, if so, would I add it to the rss or rssbits template? Or would it even work?Conceptually it could be made to work but it would take a bit of effort. It's certainly NOT a drop in solution by editing one of the templates as the feed needs to be processed. More importantly, there's no mechanism to remember what was last selected so one would always wind up with a default feed first - not much point in that if the user can't customize what's displayed. At this point I still think your best bet is the other thread.

Alternatively, there's a variation on RSS feeds being placed on forum pages that may do what you need over at vb.org. In that case the user could collapse any feeds they don't want to see. Basically, you could create a 'feeds' page that had nothing but feeds on it and let the use view only the ones they are interested in. Just a thought.

ga2000gt
01-29-2006, 01:30 PM
Bummer, thanks for the response though.

ccna
01-29-2006, 11:31 PM
this module ia working well but when i create additional RSS feeds simply copy the existing module, rename it and put it into module folder then i go to ACP --> add module--->then i got the error as below:

You already have a Module with an identifier of ''. Please select a different identifier.


who can help me

Tom M
01-29-2006, 11:51 PM
Can you explain in more detail how you are copying the module?

All you should need to do is vBa CMPS -> Edit Modules and select the original copy of the module. Once that's open select Copy in the Select an action dropdown. After that you may rename the new copy and save it.

This all works as it should with vBa 2.1.0 but there were sometimes problems doing this with 2.0.0.

ccna
01-30-2006, 02:31 AM
wow big thank for your help. i have fixed it. it's working very fine :D

Belicoso_Fino
01-30-2006, 11:44 PM
I still can't uplaod a module. Every time I try CMPS says it's not a valid module file.

I opened a ticket 6 days ago and no response.

I un-installed and re-installed everything and same thing.

I'm lost...

aggiefan
02-02-2006, 02:59 AM
Ive got a question.... on both my feeds actually (have this installed for 2 of our pages).

First I need to say I have the feeds completly working so I dont need any help on that part.

feed for podcast:
http://aggiefans.livejournal.com/data/rss
and the output page:
http://www.aggiefans.com/index.php?page=podcast

I would like to remove that white space between each new entry (and if you view the source its the link with title but to sorta get around that now I just dont put a title on each of my blog entries). It works but I would like to remove it completly if I can.

The second one is more of a problem for me
Feed we are using:
http://feedjumbler.com/1e8d5a2f/rss.xml
And the output:
http://people.tamu.edu/~jrd/frontpage.jpg (an image since i dont have it live since its not customized to how I want it)

Basically in this one I want to remove the first title tags (so it will reduce the blank space some)

Tom M
02-02-2006, 09:49 AM
Ive got a question.... on both my feeds actually (have this installed for 2 of our pages).I'm not really sure about the 1st item. It appears there's actually no Title record for the item you have there. As for the 2nd item I believe that what you're best off doing is editing the adv_portal_rssbits template to remove what you don't want. Editing will impact all the feeds that use that template so if you've got any that you don't want changed then copy the template and modify the module references accordingly.

aggiefan
02-02-2006, 01:56 PM
thanks... i fixed it.

One other little thing (and not sure if the script can do it). But in the feedjumbler feed (from google news). It throws in a <br> at the very beginning of the description. Is there a way to remove that?

Its causing some blank space on the top of each artcile and I want to keep using google news because of the way it organizes the articles.

Tom M
02-02-2006, 02:08 PM
One other little thing (and not sure if the script can do it). But in the feedjumbler feed (from google news). It throws in a <br> at the very beginning of the description. Is there a way to remove that?This is exactly why I added the Data modification code section to the module :D

If the data is always in the same spot or unique in some way then it's possibe to add code to the Data modification code section to modify it. If it's truly unique you can get by with a simple str_replace() otherwise give preg_replace() a try.

PS - I use it to add a replacement string to change all the <br> tags to <br /> so that my page still validates.str_replace(array('<BR>','<br>'), array('<BR />','<br />'), $rss_item['TITLE']);

aggiefan
02-02-2006, 02:37 PM
i thought thats what it was for but couldnt figure out how to use it.

and i only want to replace the first one... is there any option for that? because if i removed all the breaks it would make the rss feed look horrible.

Tom M
02-02-2006, 02:49 PM
i thought thats what it was for but couldnt figure out how to use it.

and i only want to replace the first one... is there any option for that? because if i removed all the breaks it would make the rss feed look horrible.You could just use substr() to do what you want. Using
$rss_item['DESCRIPTION'] = substr($rss_item['DESCRIPTION'], 4);
should do the trick. Note however that if the feed ever changes this may break things horribly :eek: as it always strips the first 4 characters regardless of what they are.

A more permanent solution would be to use preg_replace(). More info on how to use it may be found here (http://www.php.net/preg_replace).

aggiefan
02-02-2006, 03:23 PM
thanks... thats exactly what i was looking for.

http://www.aggiefans.com/ (view it in action)

aggiefan
02-02-2006, 04:42 PM
ok found one other slight issue (and its not really that big of a deal...)

but i tried to do this

str_replace(array('">'), array('" TARGET=_blank"'), $rss_item['DESCRIPTION']);

to replace the "> part of any url so each link will open in a new page. but its not writing into the source at all so is there something im missing or will it not allow you to edit the link to open in a new page (since each link in a new page will be different)

Tom M
02-02-2006, 05:54 PM
ok found one other slight issue (and its not really that big of a deal...)

but i tried to do this

str_replace(array('">'), array('" TARGET=_blank"'), $rss_item['DESCRIPTION']);

to replace the "> part of any url so each link will open in a new page. but its not writing into the source at all so is there something im missing or will it not allow you to edit the link to open in a new page (since each link in a new page will be different)That's more complicated than it needs to be (and has a couple of typo's) plus it has to be assigned back to the description ;)

$rss_item['DESCRIPTION'] = str_replace('">', '" target="_blank">', $rss_item['DESCRIPTION']);Be careful though as this will replace ALL items that have a "> in them not just <a> tags. It's really much better to use something like a preg_replace() for something like this so you can be sure only what you want is being changed.