TinyPortal

Development => Support => Topic started by: rbh on February 07, 2006, 05:18:34 PM

Title: rss feed question
Post by: rbh on February 07, 2006, 05:18:34 PM
i create an rss box and add my feed, now how do i get the links from that rss feed to open in a new window? i know the answer is easy and right under my nose but i cant get it to work. thanks
Title: Re: rss feed question
Post by: Nokonium on February 07, 2006, 05:30:21 PM
I cannot remember the title but I know it was posted by Feline.

I've found this

QuoteRSS block to open any clicked link in a new window.


Try this .. it's work ..

open TPortal.php and search for

function endElement($parser, $tagName) {


replace the function with this


function endElement($parser, $tagName) {

  // This function is used when an end-tag is encountered.

  global $insideitem, $tag, $title, $description, $link, $tpimage, $boardurl;

  if ($tagName == "ITEM") {

   echo '<div style="font-size: larger; font-weight: bold;">';

   printf("<a href=\"%s\" onclick=\"OpenWindow(this.href); return false\"'>%s</a>", trim($link),htmlspecialchars(trim($title)));

echo '</div><div class="smalltext" style="margin-bottom: 4px;">';
printf("%s", $description); // Print out the live journal entry
echo '</div>';
$title = $description = $link = $insideitem = false;
   }

}


search for


function TPparseRSS()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

$backend = $context['TPortal']['rss'];
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
// end


add after


global $boardurl, $settings;
echo '
<script type="text/javascript">
  <!--
    function OpenWindow(Link) {
    F1 = window.open("' . $boardurl . '/newsboard.php?theme=' . $settings['theme_url'] . '&url=" + Link + "'.'"'.', "News", "width=800,height=640,left=150,top=10,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes");
    }
  //-->
</script>';


and the newsboard.php (put it on your site root)


<?php

$themeurl
= '';
$url = '';
if (isset(
$_GET['theme'])) $themeurl = $_GET['theme'];
if (isset(
$_GET['url'])) $url = $_GET['url'];

echo
'
<html>
<head>
 <title>xyFrauen - News</title>
 <link rel="stylesheet" type="text/css" href="'
. $themeurl . '/style.css?rc1" >
<head>
<frameset rows="22,99%">
   <frame src="./top.php?theme='
.$themeurl.'" name="top" scrolling="no" noresize>
   <frame src="'
.$url.'" name="main" scrolling="auto" noresize>
</frameset>
</html>'
;

?>


have fun

Fel
[/quote]

Title: Re: rss feed question
Post by: bloc on February 07, 2006, 06:53:34 PM
For a quicker solution, open TPortal.php and find this line (first occurance, it appear twice):
  printf("<a href='%s'>%s</a>", trim($link),htmlspecialchars(trim($title)));


The replace it with:
  printf("<a target=_blank href='%s'>%s</a>", trim($link),htmlspecialchars(trim($title)));
Title: Re: rss feed question
Post by: Nokonium on February 07, 2006, 07:32:39 PM
What I'd really like is for a link in an RSS feed to open in the same space as the feed. That is, if you have a menu link to an RSS feed, when you click on a link in the feed it replaces the page with the feed. The reason for this is to maintain the portal identity and keep the member/guest within the portal, rather than allow them to surf off.
Title: Re: rss feed question
Post by: rbh on February 07, 2006, 11:49:02 PM
thanks guys, works like a charm  ;)

to keep from cluttering the board with questions i will post here. is there a way to keep certain blocks collapsed by default but not all of them unless i choose them to be? i suck at searching for this stuff and can never find what i am looking for, even at the smf site i think i have only managed one problem solved using the search. :uglystupid2:

what i am wanting to accomplish is a whole right side of rss feed blocks that would be collapsed by default and the users only need to expand the ones they want to read. right now it just has them all open on the initial visit which makes for some crazy scrolling down to weed through them. either collapsed by default or if you have a better suggestion on how i should present the feeds. thanks a bunch!
Title: Re: rss feed question
Post by: bloc on February 08, 2006, 12:10:31 PM
Hm. No, you can't set the inital state on them - only allow them to be non-shrinkable.

I don't see a good solution to this really...incidentally, when blocks are collapsed, they still have fetched the content..in order to magically appear when you open them again. So I would rather limit the amount of them, to the point it feels comfortable.
Title: Re: rss feed question
Post by: Nokonium on February 08, 2006, 01:13:40 PM
Quote from: Bloc on February 08, 2006, 12:10:31 PM
I don't see a good solution to this really...incidentally, when blocks are collapsed, they still have fetched the content..in order to magically appear when you open them again. So I would rather limit the amount of them, to the point it feels comfortable.

Is that the case with RSS links in the menu manager as well?
Title: Re: rss feed question
Post by: bloc on February 08, 2006, 01:32:30 PM
No, only the actual rss block.