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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,027
  • Total Topics: 21,334
  • Online today: 519
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 244
  • Total: 244

RSS Drop Down Menu Help

Started by bigb, April 13, 2006, 11:28:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bigb

I need some help please.

I am trying to tie in a drop down menu of  RSS feeds from a side block that will load into a center block or article that has a reader  script  in it.

This drop down menu works well for just about any drop down menu needed:
Just fill in the SITE URL  and the TITLE NAME and change the TITLE 1,2,3’
Add as many (<option value="http:// SITE URL "> TITLE NAME </option>) as needed.


Quote<p>RSS Reader

      
Select from our list of RSS feeds:
        <form name="formRss">
             <p>
             <select NAME="selectRss" SIZE="1">
                    <option VALUE="none" SELECTED="">Select Feed</option>
            <optgroup label="Fishing News & Reports">
                  <option value="http://www.redfishnation.com/libraries/rss/feed.rss">RedFish Nation News</option>
                  <option value="http:// SITE URL">TITLE NAME</option>
            </optgroup>

            <optgroup label="Comics">
                  <option value="http://www.tapestrycomics.com/dilbert.xml">Dilbert</option>
                  <option value="http:// SITE URL "> TITLE NAME </option>
            </optgroup>

             <optgroup label="TITLE 3">
                  <option value="http:// SITE URL "> TITLE NAME </option>
                  <option value="http:// SITE URL "> TITLE NAME </option>
            </optgroup>

</select>         
<input TYPE="BUTTON" NAME="RssB2" VALUE="Load Feed" ONCLICK="goToPageRss()" /></p>
  </form>

<script type="text/javascript">
function goToPageRss()
{
PageIndex3=document.formRss.selectRss.selectedIndex
$backend = "http://www.redfishnation.com/libraries/rss/feed.rss"
if (document.formRss.selectRss.options[PageIndex3].value != "none")
{
Rssfile = formRss.selectRss.options[PageIndex3].value;
$backend = Rssfile;


}
}
</script>

It will then set your $backend variable to you selected SITE URL

How do I get the $backend variable to carryover into the reader script below:

If you place this reader script in a article of block it will load a rss feed as long as you set the $backend is set to your URL in the script.  How do I get it to pull from the dropdown script.

Quote
// An RSS Reader to grab news from whichever site you choose
// $backend = "http://www.redfishnation.com/libraries/rss/feed.rss"; //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\">
   ";
  printf("<p><a href='%s'>%s</a></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 "
";
   $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 for any ideas and help.

bigb

Is there a way to load this RSS reader script into an IFRAME in a center block. If so can someone please tell me how.




Quote// An RSS Reader to grab news from whichever site you choose
// $backend = "http://www.redfishnation.com/libraries/rss/feed.rss"; //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\">
   ";
  printf("<p><a href='%s'>%
s[/url]</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 "
";
   $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);

rbh

#2
well, it isn't exactly what you are trying to do, but look how i did mine, http://www.redneckrefuge.com the rss feed box is in the lower left corner. choose an rss feed click go and the feeds open in a new page. i havent gotten the time to get the pages to match my forum yet so they are just plain white backgrounds with blue links, but you will get the idea. if you want to use this method rather then them loading an article and such, let me know.

bigb

Cool rbh, this might work.

  What files are needed to get this to work and where can I find them.

Thanks bigb.

rbh

    one part of it is http://www.rss2html.com/ and i chose option 2, its a free little program and the instructions are really simple and straight forward. i use the sample.html that comes with it and you can just add some html to it for changing background, adding graphics, or whatever you choose. you have a drop down menu so i wont post that here. if you have a question just let me know, but it was pretty easy to figure out and it really frees up room on your tinyportal main page. :up:

bigb

Thanks I think this will work.

bigb

#6
Man this works great thanks for the help.  :laugh:

I set it up to pull from a dropdown menu block and load in a center box or article in an  Automatic resizing  Iframe.
The only problem I have is that I can’t get it to match my theme.

The script uses a vary simple template to load the information into an I frame a file called sample-template.html

Quote<HTML>
    <HEAD>

        <TITLE>
            ~~~FeedTitle~~~
        </TITLE>
    </HEAD>
    <BODY>
        <H1>~~~FeedTitle~~~</H1>
        <H2>~~~FeedDescription~~~</H2>
        <BR>
        <TABLE width="100%">
            ~~~BeginItemsRecord~~~
            <TR>
                <TD>
                    ~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~
                </TD>
            </TR>
            <TR">
                <TD>
                    <B><A href="~~~ItemLink~~~">~~~ItemTitle~~~</A></B>
                </TD>
            </TR>
            <TR>
                <TD>
                    ~~~ItemDescription~~~
                    <BR>
                </TD>
            </TR>
            ~~~EndItemsRecord~~~
        </TABLE>
    </BODY>
</HTML>


What do I insert in this basic template so it will load the style.css  settings so it will match the loaded default theme. :o

Thanks for the help.

rbh

i dont know how to get it to load the stylesheet.....all i did was add html to the sample template so the pages match my forum. you can add banners and whatever else you want to the rss feed pages.

open the sample html file with an editor and paste <body bgcolor="#000000"> after the body tag and change the zeros to whatever color matches your forum background. you can change the link colors and text colors the same way.

bigb

Ok this is almost it.  :-\ The only thing I am having problems with is the href="style.cssâ€Ã,

This line should be something like this

Quote<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], 'â€Ã,\style.css" >

to load the default style sheet.  But I can’t get the syntax right to get it to load from the default theme_url

If I use  <link href="style.css" rel="stylesheet" type="text/css">  it will load the style sheet in the root.

This is the part I can't get right href="', $settings['theme_url'], 'â€Ã,\style.css"

The sample-template.html with style tags.

Quote

<HTML>
    <HEAD>

        <TITLE>
            ~~~FeedTitle~~~
        </TITLE>
        <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], 'â€Ã,\style.css" >

        <link href="style.css" rel="stylesheet" type="text/css">

    </HEAD>
    <BODY >
        <H1 class="#headerarea">~~~FeedTitle~~~</H1>
        <H2 class="#headerarea" >~~~FeedDescription~~~</H2>
        <BR>
        <TABLE width="100%" class="tborder">
            ~~~BeginItemsRecord~~~
            <TR class="windowbg">
                <TD>
                    ~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~
                </TD>
            </TR>
            <TR class="windowbg2">
                <TD>
                    <B><A href="~~~ItemLink~~~" a:link>~~~ItemTitle~~~</A></B>
                </TD>
            </TR>
            <TR class="windowbg2" >
                <TD>
                    ~~~ItemDescription~~~
                    <BR>
                </TD>
            </TR>
            ~~~EndItemsRecord~~~
        </TABLE>
    </BODY>
</HTML>

Can someone please tell me what I am doing wrong with this line?   :o

Quote<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], 'â€Ã,\style.css" >


Thanks for the help.

rbh

#9
keep the sample html with the changes you have above, then move your rss2html.php into your themes folder that you are using, then re edit the links pointing to the correct directory for the rss2html.php. i just tried it and it worked like a charm.

This website is proudly hosted on Crocweb Cloud Website Hosting.