TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 01:26:12 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 45
  • Total: 45

[done!] RSS block (site displays a.s.a.p, then RSS feeds are loaded)

Started by gijs, December 06, 2006, 11:09:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gijs

TP/SMF Website now is loaded independent from (slow/not working) RSS feeds

Using this script:
http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm

Required actions to get this working:
- upload script to a folder on your site
- add some extra code in the header of your site
- add a small piece of javascript in a block to display a RSS feed

All instructions can be found on the page mentioned above. Got it working in 15 min.

haxen

yes, you are correct.  this is a superb RSS reader that is nicely customizatble.  The feature that I like is being able to set how many stories are parsed.

You can see a Digg RSS feed on stories about the PS3 as an example of this implementation at www.ps3hax.com

thanks for the link

sfboarders

I am having problems implementing this mod. I followed the directions step by step from here but all I am receiving is a js error in IE and nothing showing in the box. Seems pretty self explanatory. Any ideas? Code below:

code in index.template.php


}
    setmysize(szs[ sz ]);
}

// ]]></script>
<link rel="stylesheet" type="text/css" href="rssbox/rssdisplaybox.css" />
<script type="text/javascript" src="rssbox/virtualpaginate.js"></script>

<script type="text/javascript" src="rssbox/rssdisplaybox.js">

/***********************************************
* RSS Display Boxes- Ã,© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>
</head>
<body>';

echo '
<div id="maintable">


Code in html + BBC box


<script type="text/javascript">
var showbbc=new rssdisplaybox("bbc", "bbcid", "someclass")
showbbc.set_items_shown(10) //show 10 entries from feed
showbbc.start() //Required: start script
</script>


Edited rssdisplaybox.js


//Path to "main.php" *relative* to "demo.htm", or the HTML page on your server displaying the RSS Box:

var rssoutputscript="rssbox/main.php"

//Switch to full URL to "main.php" on your server below, so script will work with any page on your server, not just "demo.htm"
//Do NOT change window.location.hostname, which is your site's root domain, dynamically determined
//Configure below line and uncomment it to activate it:

rssoutputscript="http://"+window.location.hostname+"/rssbox/main.php"


////////////No need to edit beyond here//////////////


The line of code where I am receiving the js "Syntax Error" while viewing the source.


<div class="windowbg" style="padding:4px; " id="block25"><script type="text/javascript"><br />var showbbc=new rssdisplaybox("bbc", "bbcid", "someclass")<br />showbbc.set_items_shown(10) //show 10 entries from feed<br />showbbc.start() //Required: start script<br /></script></div></div>


gijs

First try this:

I used a 'scriptbox' and not html + BBC. Think this is required to make the javascript work.
(just tried it: when I use html+BBC instead of scriptbox I do get a syntax error too!!)

your code looks fine to me (when I put it in a block on my site it works)

So I think this should do it already. Just use a 'scriptbox' instead.


Then If things still not work, try this:

in rssdisplaybox.js I have

instead of

var rssoutputscript="rssbox/main.php"

the line

rssoutputscript="http://"+window.location.hostname+"/portal/rss/rssbox/main.php"

Notice the missing 'var'. 'Portal' is the folder where SMF is installed (folder resides in the root of my site: www.mysite.com/portal)

Can't remember why I made the change though, so you might not need to change this.

sfboarders

Thanks gijs. I turned the box into a script box and it worked!  :)

haxen

I am having a problem in showing 2 rss feeds in separate boxes.  The bottom one always shows blank and the top one seems to load the first feed, and then overwrites it with the second feed.  can you verify if this is your experience?  I am using scriptboxes for the script.

gijs

Easy: just name the variable different:

for example in block 1:
'showbbc'

and in block 2:
'showbbc2'

(did that solve your problem?)

sfboarders

you know how to get the links to popup in a new window? I don't want people leaving the site when they click on a link.

Also do you know a good source of rss feeds? I am having a hard time finding specific type of feeds.

"San Francisco tide predictions/tables"
and "Lake Tahoe traffic conditions"

:)

gijs

Open the file 'outputbody.php'. In it you'll find all versions for displaying a rss-feed.
Select the one you're using and add  'target="_blank"' to it, for example:

<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>" target="_blank"><?php echo $item->get_title(); ?></a></div>

that should open all links in a new window