vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   RSS stuff help needed (https://vborg.vbsupport.ru/showthread.php?t=202057)

TimberFloorAu 01-16-2009 11:05 PM

RSS stuff help needed
 
Okies, I have never ever used RSS before, have no idea how and what you use it for, but I am trying to get my head around it.

I had asked this question before, in another format, but hoping someone can help.

Example: rss feed on our site is

http://www.yobromofo.com/forum/exter...SS2&forumid=40

Now as far as i know, ( noob ) this is rss thats already parsed, but where do i get the xml for this particular feed, so that I can integrate it on a 2nd website, and display the feed within that websites pages.

Ste

Lynne 01-16-2009 11:16 PM

Is this kinda what you are looking for? [HowTo] Display your latest threads on an external page using an RSS2 feed

TimberFloorAu 01-17-2009 12:10 AM

Lynne I hope so !

Will take a gander thankyou :up:

--------------- Added [DATE]1232159146[/DATE] at [TIME]1232159146[/TIME] ---------------

works a treat thanks !!

--------------- Added [DATE]1232159234[/DATE] at [TIME]1232159234[/TIME] ---------------

is there a way to indicate the last posters name ? within the xml

--------------- Added [DATE]1232168071[/DATE] at [TIME]1232168071[/TIME] ---------------

Ok now I need to apply CSS.

Having looked around, it appears inline css is the go. How is this achieved using VB.com version of parsing rss feed.

How do we apply style attributes to the rss elements.

Ste

Lynne 01-17-2009 03:11 AM

You can add it inline in here:
PHP Code:

$rss2_output .= "<dt><strong><a href='" trim($link) . "'>" htmlspecialchars(trim($title)) . "</a></strong> - " htmlspecialchars(trim($date)) . " by <em>" htmlspecialchars(trim($author)) . "</em></dt><dd>" htmlspecialchars(trim($description)) . "</dd>"

You notice that they use the definition list html to display it. You could add css for that in the Main CSS - probably give the div that it is all in an id and then you can define "#yourid dt" and "#yourid dt" in there, then you wouldn't need to do it inline. Or, you could not use the definition list to output it, but instead use a table or whatever.

TimberFloorAu 01-17-2009 03:33 AM

OK.

But.

Code:

$rss2_output .= "<dt><strong><p style="color: sienna; margin-left: 20px">
<a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></p></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";

Produces an error over the original code below.

Code:

$rss2_output .= "<dt><strong>
<a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";

Am i so dense I am missisng something painfully obvious lol

Lynne 01-17-2009 03:41 AM

It's because you aren't escaping your quotes. - \" instead of " (when you want to have the quote there). So:

HTML Code:

$rss2_output .= "<dt><strong><p style=\"color: sienna; margin-left: 20px\">
<a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></p></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";

You probably need to put the color inside the <a> tag. Also, don't use <p>, use <span>.

HTML Code:

$rss2_output .= "<dt><strong>
<a href='" . trim($link) . "'><span style=\"color: sienna; margin-left: 20px\">" . htmlspecialchars(trim($title)) . "</span></a></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";


TimberFloorAu 01-17-2009 04:56 AM

Thanks Lynne.

I am slowly getting there, its all new to me. Albeit I have done css , this is a bit weird lol.

Ok now I have:

Code:

$rss2_output .= "<dt><strong>
<a href='" . trim($link) . "'><span style=\"font-family: sergo UI,sans-serif;font-size:16px;text-decoration: underline;color: #73a202; margin-left: 20px\">" . htmlspecialchars(trim($title)) . "</span></a></strong> - <span style=\"font-family: sergo UI,sans-serif;font-size:12px;color: #92b5e7\">" . htmlspecialchars(trim($date)) . "</span>  <span style=\"font-family: sergo UI,sans-serif;font-size:14px;color: #bbbbbb\">" . htmlspecialchars(trim($author)) . "</span></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";

I am struggling to style the description.

Appreciate your help again :)

SEOvB 01-17-2009 05:00 AM

There are a few external sites and even an rss2html tool that will give you a little easier control of how to display the feed, maybe a little easier or ideas for something different

http://www.rss-specifications.com/display-rss.htm
http://jade.mcli.dist.maricopa.edu/f...ex.php?s=build
http://rssxpress.ukoln.ac.uk/lite/include/?t=1
http://www.rss-to-javascript.com/p/138.html
http://www.rss2html.com/step-1.php

TimberFloorAu 01-17-2009 05:05 AM

Quote:

Originally Posted by FRDS (Post 1715432)
There are a few external sites and even an rss2html tool that will give you a little easier control of how to display the feed, maybe a little easier or ideas for something different

http://www.rss-specifications.com/display-rss.htm
http://jade.mcli.dist.maricopa.edu/f...ex.php?s=build
http://rssxpress.ukoln.ac.uk/lite/include/?t=1
http://www.rss-to-javascript.com/p/138.html
http://www.rss2html.com/step-1.php


Thanks Mate.
I had tried rss2html, wasnt that keep. Magpierss i couldnt get my head around. Will look at the others tho, much appreciated.
The vb rss works fine, for external pages.

Just the styling is a bit arse about face lol. My one concern is , is the page ( on the external site ) spiderable by search engine robots, or is the feed treated similarly to iframes, and ignored as non page content ?

Any suggestions please.

SEOvB 01-17-2009 05:19 AM

It should be spiderable, if you use view source you should be able to get an idea of what it out puts, most output html that gets generated from using javascript

TimberFloorAu 01-17-2009 05:24 AM

Thanks I was hoping that was the case.

Do you know a way ( my son does but he has gone away on hols for a few days ) --- of extracting the keywords from the page, and injecting them into that pages metatags on the fly.?

--------------- Added [DATE]1232177440[/DATE] at [TIME]1232177440[/TIME] ---------------

Ok sorted the rss/css issue i think. Albeit its a bit ugly, will refine now I am upto speed:

Code:

$rss2_output .= "<dt><strong>
<a href='" . trim($link) . "'><span style=\"font-family: sergo UI,sans-serif;font-size:16px;text-decoration: underline;color: #73a202; margin-left: 20px\">" . htmlspecialchars(trim($title)) . "</span></a></strong> - <span style=\"font-family: sergo UI,sans-serif;font-size:12px;color: #92b5e7\">" . htmlspecialchars(trim($date)) . "</span>  <span style=\"font-family: sergo UI,sans-serif;font-size:14px;color: #bbbbbb\">" . htmlspecialchars(trim($author)) . "</span><br /><span style=\"font-family: sergo UI,sans-serif;font-weight:bold;font-size:14px;color: #bbbbbb; margin-left: 20px\">" . htmlspecialchars(trim($description)) . "</span></dt>";


Lynne 01-17-2009 02:14 PM

If you give us an idea of what you want it to look like, maybe we can help with the styling.

TimberFloorAu 01-17-2009 07:16 PM

To Be honest, I am getting to grips with the css. Still not sure how to apply hover to the links, when using inline style tho.

I am taking this one stage at a time tho.

My issue is,... perhaps its a cacheing issue.

1. when we load the external page initially, and it fetches the feed, it returns a blank page. When we refresh the page, it fetches the feed.

2. I would like to style the webpage/site of our new site to match as closely as possible the sister site we are fetching the feeds from.

...many more questions to come tho.

3. sample page here http://www.british-expats.com.au/index2.php , for some reason I cannot get it to echo the Author.

Lynne 01-17-2009 07:25 PM

1. It loaded fine for me, but seemed to load twice on it's own. You are missing stuff at the top of your html page, but I don't know if that is what is causing the issue. (Take a look at the page source for this page).

edit: whoops, spoke too soon. I just tried to reload it and got a blank page. Check your error_logs.

2. If you have permission, you can probably use their style sheet.

3. Weird that the author doesn't show up. Check that you copied the code correctly.

TimberFloorAu 01-17-2009 07:49 PM

Quote:

Originally Posted by Lynne (Post 1716074)
1. It loaded fine for me, but seemed to load twice on it's own. You are missing stuff at the top of your html page, but I don't know if that is what is causing the issue. (Take a look at the page source for this page).

edit: whoops, spoke too soon. I just tried to reload it and got a blank page. Check your error_logs.

2. If you have permission, you can probably use their style sheet.

3. Weird that the author doesn't show up. Check that you copied the code correctly.

Will do, i just did the html in editplus, and havent added compliance stuff etc.

I could contact the originator, and see what is the go. Not sure on the author part, was wondering if it was a vbseo issue. Does vbseo rewrite the forum id's within rss. Seems to if we use the explicit:

external.php?type=RSS2

when viewing the feed links they have been re-written.

So perhaps when supplying the feed via ext webpage, the rewrite is trying to rewrite what is already rewritten !! lol

So perhaps I should be parsing the feed as:

external.php?type=RSS2&f=barbie

instead of

external.php?type=RSS2&f=3

When I give the rewrite code as in =barbie ( name of a forum ) it seems to load immediately, with little or no lag or blank pages.

I am thinking perhaps this could be a contributing factor.

--------------- Added [DATE]1232229340[/DATE] at [TIME]1232229340[/TIME] ---------------

Just an aside, :

1. when using external.php?type=RSS2&f=barbie if we click on a link in the feed, we dont get the pingback function.

if we use external.php?type=RSS2&f=3 we do ???

Also where do i add, target="_blank" to the links.

Lynne 01-17-2009 09:54 PM

I don't know anything about vbseo (except it seems to cause users a lot of problems :D), so I can't help with that issue.

Regarding target="_blank", it goes in the <a> tag:
Code:

<a href='" . trim($link) . "' target=\"_blank\">

TimberFloorAu 01-17-2009 10:14 PM

Goodonya Lynne, I swear I tried that lol.

Ok 3 issues remain.

1. no author. Weird huh
2. blank page, then ok on refresh ( in FF havent tried IE or Chrome )
3. css hover for links, and visited.

Ste

Lynne 01-17-2009 11:39 PM

1. Post your code and maybe we can see why the author isn't showing up.

2. If you aren't having the problem by doing f=barbie, then just make the call that way.

3. I don't think you can do that with css inline. Maybe with javascript, but not css. You should define it on the bottom of your Main CSS page and then use that class in your code.

TimberFloorAu 01-17-2009 11:45 PM

Quote:

Originally Posted by Lynne (Post 1716296)
1. Post your code and maybe we can see why the author isn't showing up.

2. If you aren't having the problem by doing f=barbie, then just make the call that way.

3. I don't think you can do that with css inline. Maybe with javascript, but not css. You should define it on the bottom of your Main CSS page and then use that class in your code.

Thanks Lynne ( you really are a star you know )

Code is as follows:

Code:


<HTML>
 <HEAD>
  <TITLE> Test </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 
 </HEAD>

 <BODY>
 

<?php

// ######################################################
// ## configuration
 // ##
 
 $rss2_file = 'http://www.yobromofo.com/forum/external.php?type=RSS2&f=barbie';
   
 // ## configuration end
 // ######################################################
 // ## Do not touch code below!
   
   
 $is_item = false;
 $tag = '';
 $title = '';
 $description = '';
 $link = '';
 $date = '';
 $author = '';
   
 function character_data($parser, $data)
 {
    global $is_item, $tag, $title, $description, $link, $date, $author;
    if ($is_item)
    {
        switch ($tag)
        {
            case "TITLE":
            $title .= $data;
            break;
   
            case "DESCRIPTION":
            $description .= $data;
            break;
   
            case "LINK":
            $link .= $data;
            break;
   
            case "PUBDATE":
            $date .= $data;
            break;
   
            case "AUTHOR":
            $author .= $data;
            break;
        }
    }
 }
   
 function begin_element($parser, $name)
 {
    global $is_item, $tag;
    if ($is_item)
    {
        $tag = $name;
    }
    else if ($name == "ITEM")
    {
        $is_item = true;
    }
 }
   
 function end_element($parser, $name)
 {
    global $is_item, $title, $description, $link, $date, $author, $rss2_output;
    if ($name == "ITEM")
    {
        $rss2_output .= "<dt><strong>
<a href='" . trim($link) . "'target=\"_blank\"><span style=\"font-family: sergo UI,sans-serif;font-size:16px;text-decoration: underline;color: #73a202; margin-left: 20px\">" . htmlspecialchars(trim($title)) . "</span></a></strong> - <span style=\"font-family: sergo UI,sans-serif;font-size:12px;color: #92b5e7\">" . htmlspecialchars(trim($date)) . "</span>  <span style=\"font-family: sergo UI,sans-serif;font-size:14px;color: #bbbbbb\">" . htmlspecialchars(trim($author)) . "</span><br /><span style=\"font-family: sergo UI,sans-serif;font-weight:bold;font-size:14px;color: #bbbbbb; margin-left: 20px\">" . htmlspecialchars(trim($description)) . "</span></dt><br />";
        $title = "";
        $description = "";
        $link = "";
        $date = "";
        $author = "";
        $is_item = false;
    }
 }
   
   
 $parser = xml_parser_create();
   
 xml_set_element_handler($parser, "begin_element", "end_element");
 xml_set_character_data_handler($parser, "character_data");
 $fp = fopen($rss2_file,"r");
   
 while ($data = fread($fp, 4096))
 {
    xml_parse($parser, $data, feof($fp));       
 }
   
 fclose($fp);
 xml_parser_free($parser);
?>

<?php echo $rss2_output;?>
 </BODY>
</HTML>


Lynne 01-18-2009 03:19 AM

Change this line:
PHP Code:

             case "AUTHOR"

To this:
PHP Code:

             case "DC:CREATOR"


TimberFloorAu 01-18-2009 07:08 PM

Worked a treat Lynne.

Thankyou !!!!

Incidentally posted a couple of questions over at vb.com regarding some of the page refresh issues ( am thinking its a form of cache )

Not a single reply.

Issues remain, :-

1. page requires refresh if it spits out a blank page to display feed.

mizamlar 01-25-2009 02:29 PM

Thanks TimberFloorAu,

I can see latest active threads in another php page.
But I just want to ask you that Do you know that how can I publish latest active threads (topics) in a html or php page in tables? (like forum view Topic , Date, Views, Sender ...)

Another working link here useing JavaScript:
http://www.vbulletin.com/forum/showthread.php?t=283817

Exam:
http://www.islamkent.org/cpurigs.jpg

Lynne 01-25-2009 03:05 PM

Several threads on how to pull threads via javascript:
[HowTo] Display your latest threads on an external page using an RSS2 feed
[HowTo] Display your latest threads on an external page using an XML feed
[HowTo] Display your latest threads on an external page using an RSS feed

The problem with using the external.php feed to get the latest threads is that you are limited in the data you will get - Thread Title and threadid, author, date. If you want something like what your image shows, I think you will need to actually write a query and then format the output of that query.


All times are GMT. The time now is 02:13 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.01238 seconds
  • Memory Usage 1,829KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_html_printable
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (23)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete