Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 12:10:02 AM

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.
155533 Posts in 21713 Topics by 7738 Members
Latest Member: Pattieardathfe
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Display News Reader / RSS feed in a different part of template  (Read 592 times)
PJW

Offline Offline

Posts: 31


« on: September 20, 2009, 07:46:54 PM »

Hi,

I've installed the News Reader module from http://addons.websitebaker.org/pages/modules/page-modules.php which works great (although I had to modify one of the files to remove a non-existent image, but not a major issue).

However, rather than have the RSS feed display on a page (within 'Content') I would like to display a couple of posts in the right-hand column, the 'rightside' div in the template I'm using: andreas09 (under the 'Search' form), so that they're visible on any page of the website.

I realize that this would mean editing the template, but I'm not very familiar with PHP yet, so I'd appreciate some help doing this - or a pointer to some code to use, if there already is some.

I'm not sure if this will re-use code files from the News Reader module, or will just require new code, and the News Reader module could then be uninstalled?

TIA,
Paul
« Last Edit: September 20, 2009, 09:58:05 PM by PJW » Logged

Paul
PJW

Offline Offline

Posts: 31


« Reply #1 on: September 22, 2009, 10:22:10 AM »

Is it possible to do this by linking to the News Reader module code?  Or should I be looking for a different solution for displaying an RSS feed in my template?

Any help appreciated Smiley
Logged

Paul
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6975


WWW
« Reply #2 on: September 22, 2009, 06:31:37 PM »

There is some explanation about "global blocks" somewhere here in the forum (sorry, no direct link at the moment). Sections together with blocks and global blocks is what you need.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

PJW

Offline Offline

Posts: 31


« Reply #3 on: September 22, 2009, 10:26:05 PM »

Thanks Klaus,

The solution in the first topic I looked at wouldn't work for me (using PHP includes), but that topic linked to http://www.websitebaker2.org/forum/index.php/topic,3217.0.html

The code there works for me:
Code:
<?php
// Change to the number you need!
$section_id 65;

// Get requested section for requested page
$query_sections $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' ");

// Make sure there is one
if($query_sections->numRows() > 0) {
    
$section $query_sections->fetchRow();
    
$section_id $section['section_id'];
    
$module $section['module'];
    require(
WB_PATH.'/modules/'.$module.'/view.php');

?>

It's not the way I had imagined doing this, but it's working Smiley

Now, I need to find out if it's possible to reduce the number of characters that are displayed in News Reader posts...

BFN,
Logged

Paul
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!