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,004
  • Total Topics: 21,330
  • Online today: 500
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 381
  • Total: 381

Blocks

Started by Prasad007, February 20, 2006, 04:09:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Prasad007

whats the diff between Center Blocks and Frontpage Blocks ??

Prasad007

cmon guys please help!!!

Prasad007

what does this site use for the announcement abt TP on the home page ?

gerrymo

Quote from: Prasad007 on February 20, 2006, 04:09:21 PM
whats the diff between Center Blocks and Frontpage Blocks ??


Center blocks can be displayed when in the forum. Frontpage blocks are only displayed on the front page.

Gidget

Hi gerrymo

I've got a related question - I think  :-\

On my site I want to display a couple of RSS feeds, but I don't want them to appear on the front page.  I can get them to work okay if I use a front page block, but I actually want to link to them from a menu selection in a front page left block.  I want the RSS feeds to open in a new page in the TP theme frame.

If I define an RSS feed as a center block (not on the front page) it shows up on the front page - is there any way I can make it open in a new page?  Alternatively, is there any way I can display an RSS feed in an article (I tried, but it didn't parse)?

I'm using SMF 1.1 RC2, TP 0.8.6 with TP Amber theme.

Thanks in advance for any help  :)

Cheers

Gidget

Nokonium

I have had multiple RSS feeds working in articles, but it took some file hacking to do it. You appear to need to parse each RSS feed seperately. This example is for one I use, to customise it you will have to give each feed its own function and add the url as the backend.

In TPortal.php

<find>
   function TPparseRSSnews()
</find>

<add before>
// RSS newsfeed for BBC sci-tech
function RSSbbctech()
{
                global $context, $settings, $options, $scripturl, $txt, $modSettings;

$backend = 'http://newsrss.bbc.co.uk/rss/newsplayer_uk_edition/sci-tech/rss.xml';
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
// end


// 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);

}


Then add a php article

global $context, $settings, $options, $scripturl, $txt, $modSettings;

         echo '<div style="padding: 5px;" class="smalltext">';
         RSSbbctech()  ;
         echo '</div>';

Gidget

#6
Hi nokonium

Thank you very much for this  :)

I edited TPortal.php as per the first code box in your post, changing the RSS function to my feed [RSSpolio()] and changing the backend to my Google news feed.

I added a second function below that one in TPortal.php (again using all the code in your first box), for my second RSS feed [RSSpostpolio()] and changed the backend of that one to my other Google news feed.

I didn't make any other changes in TPortal.php.  (By the way, not being very familar with where I would find TPortal.php, I first edited the copy in smforum/Packages/TP086/Sources  ::) instead of the one in smforum/Sources - silly me :))

After creating the php articles, the feeds are working  :)

And now for the problem  :(

The edited TPortal.php makes the headers in my left bar menu totally disappear from view (they still show up okay in Menu Manager).  Bloc recently made some changes (included in his last update) to the headers because in the Amber theme they were not showing up correctly.  This thread is relevant.

If I return to using the original (unedited-for-RSS) TPortal.php, the headers magically reappear.

Any ideas re what I need to do to get both RSS feeds in articles and headers?   :laugh:

Also, is there a way to get any apostrophes in the feed parsed correctly, instead of appearing as &#39; ? (I did a Google search but much of what I found went over my head.)

Thanks again for your help so far.

Cheers

Gidget

Nokonium

I have it working in a default based theme, I don't have any other of Bloc's themes installed, unless it is down to something like missing a ; or } on copy and paste I'm  :-\

Prasad007

Quote from: gerrymo on February 20, 2006, 05:19:18 PM
Quote from: Prasad007 on February 20, 2006, 04:09:21 PM
whats the diff between Center Blocks and Frontpage Blocks ??


Center blocks can be displayed when in the forum. Frontpage blocks are only displayed on the front page.
oh i see. thanks for the info! :)

Prasad007

i just added a frontpage block and activated it. But it isnt showing!! please help!.
but if i put it as center it shows.
but i dont want it in forum so what do i do??
please help!!!

This website is proudly hosted on Crocweb Cloud Website Hosting.