Welcome, Guest. Please login or register.
Did you miss your activation email?
May 22, 2012, 03:29:27 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155366 Posts in 21695 Topics by 7729 Members
Latest Member: piset
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: How to show links to latest news from other site  (Read 778 times)
Argos
Moderator
**
Offline Offline

Posts: 2154


WWW
« on: June 19, 2008, 02:43:02 PM »

I wanted to show links to latest news from WB site A on WB site B. I could not find information on this in the forum, so I have used a little trick to do it using RSS. Maybe others will find this useful too. I used the free script "RSS2HTML" from http://www.feedforall.com/download.htm.

Site A: www.bereikbaarheid. nl
Site B: www.itojaarcongres. nl

You can see the 5 latest news items from site A in the left column on site B. Clicking on an item will open the news item on site B in a new window.

1. Install and configure the RSS2HTML script on site B, for example in a subdir of your template. There are good instructions supplied, and a sample template. The bare minimum to show clickable links only:

Code:
~~~BeginItemsRecord~~~
<a href="~~~ItemLink~~~">~~~ItemTitle~~~</a><br>
~~~EndItemsRecord~~~

2. Include the PHP file from the script in the (index.php probably) template of site B, like so:

Code:
<?php include("http://www.your-domain-here.com/wb/path-to-template/rss2html/rss2html.php"); ?>

3. Open the rss.php file from the news module of site A. Add the number of items from site A you want to show on site B, for example the latest 5, by adding "LIMIT 0, 5" to the end of the query. Like so:

Code:
$query = "SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE page_id=".$page_id." AND active=1 ORDER BY posted_when DESC LIMIT 0, 5";

And modify the rss.php further if needed.

4. Find out what the page ID is of the new you want to show (hover above the news items in the admin, and you'll see the page ID in the urls'). This ID has to be used when calling the rss.php file. So for example:

Code:
http://www.your-domain-here.com/wb/modules/news/rss.php?page_id=xx (where xx will be a number)

5. Put the above line in the rss2html.php file of the script. You'll see where.

After uploading it all, it should work. That's it  grin
Of course you can use the script to show RSS content from other (non WB) sites on your site as well. It's a cool little script I think.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
marathoner

Offline Offline

Posts: 495


« Reply #1 on: June 20, 2008, 03:22:49 AM »

Nice tip Argos!

I also show information from one WB site on another WB site. In this case, WB site B that displays a list of calendar events from WB site A. I created a hidden page on WB site A to display the data the way that I want it displayed on WB site B. Then on WB site B, I use an inline wrapper section to retrieve the hidden page from WB site A. I disable the inline wrapper style sheet so that I can style the page consistent with WB site B styling.

This allows me to maintain a single event calendar but present it in different formats on different sites.
Logged
Argos
Moderator
**
Offline Offline

Posts: 2154


WWW
« Reply #2 on: June 20, 2008, 09:11:53 AM »

Ah, that's a nice trick as well! I can use that on one of my sites too.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
vyni

Offline Offline

Posts: 566


« Reply #3 on: June 20, 2008, 09:56:28 AM »

@Argos

I find this nice.
 cool But - did You ever hear of anynews? - this little module is doing great. It shows news (selectable groups, nr of rows) on any page you want - without modifying the template.
Give it a try!
http://addons.websitebaker.org/pages/modules/code-snippets.php

Best regards from Himberg.

Uuuups - missunderstanding from mine - I thought it is in the same WB - site!  cheesy
« Last Edit: June 20, 2008, 10:03:12 AM by vyni » Logged

PS: Falls jemand eine Idee hat was zu tun ist und mir das erklären könnt - geh bitte davon aus dass ich ahnungslos bin, was php und so betrifft. Ich kann grad was lesen, kopieren und einfügen,  ungefähr verfolgen und glauben.
Argos
Moderator
**
Offline Offline

Posts: 2154


WWW
« Reply #4 on: June 20, 2008, 09:58:56 AM »

Sure I've heard of Anynews, I use it alot  smiley
But that can't be used to show news from another site, or did I miss something?
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
vyni

Offline Offline

Posts: 566


« Reply #5 on: June 20, 2008, 10:12:01 AM »

 grin Look at the red line below!  grin
Somewhere i found this litte lines to show sport-news from a local newspaper:
Code:
<script src="http://www.1a-network.de/cgi-bin/ngr/newsgrabber.cgi?a=1&js=1&name=kurier-sport&max=10&time=3600">
</script>
So your tip will do the same - but just from annother (maybe own) WB-installation ??

 cheesy Now I have it.
Logged

PS: Falls jemand eine Idee hat was zu tun ist und mir das erklären könnt - geh bitte davon aus dass ich ahnungslos bin, was php und so betrifft. Ich kann grad was lesen, kopieren und einfügen,  ungefähr verfolgen und glauben.
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!