1
noo-b
xnews and backend.php
  • 2010/5/13 10:30

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


this is xoops.2.4.4 backend php

/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 *  Xoops Backend
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         kernel
 * @since           2.0.0
 * @author          Kazumi Ono 
 * @version         $Id$
 */
include dirname(__FILE__) . DIRECTORY_SEPARATOR 'mainfile.php';

$GLOBALS['xoopsLogger']->activated false;
if (
function_exists('mb_http_output')) {
    
mb_http_output('pass');
}
header('Content-Type:text/xml; charset=utf-8');

include_once 
$GLOBALS['xoops']->path('class/template.php');
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
if (!
$tpl->is_cached('db:system_rss.html')) {
    
xoops_load('XoopsLocal');
    
$tpl->assign('channel_title'XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
    
$tpl->assign('channel_link'XOOPS_URL '/');
    
$tpl->assign('channel_desc'XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    
$tpl->assign('channel_lastbuild'formatTimestamp(time(), 'rss'));
    
$tpl->assign('channel_webmaster'checkEmail($xoopsConfig['adminmail'], true));
    
$tpl->assign('channel_editor'checkEmail($xoopsConfig['adminmail'], true));
    
$tpl->assign('channel_category''News');
    
$tpl->assign('channel_generator''XOOPS');
    
$tpl->assign('channel_language'_LANGCODE);
    
$tpl->assign('image_url'XOOPS_URL '/images/logo.png');
    
$dimention getimagesize(XOOPS_ROOT_PATH '/images/logo.png');
    if (empty(
$dimention[0])) {
        
$width 88;
    } else {
        
$width = ($dimention[0] > 144) ? 144 $dimention[0];
    }
    if (empty(
$dimention[1])) {
        
$height 31;
    } else {
        
$height = ($dimention[1] > 400) ? 400 $dimention[1];
    }
    
$tpl->assign('image_width'$width);
    
$tpl->assign('image_height'$height);
    if (
file_exists($fileinc $GLOBALS['xoops']->path('modules/news/class/class.newsstory.php'))) {
        include 
$fileinc;
        
$sarray NewsStory::getAllPublished(100true);
    }
    if (!empty(
$sarray) && is_array($sarray)) {
        foreach (
$sarray as $story) {
            
$tpl->append('items', array(
                
'title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)) ,
                
'link' => XOOPS_URL '/modules/news/article.php?storyid=' $story->storyid() ,
                
'guid' => XOOPS_URL '/modules/news/article.php?storyid=' $story->storyid() ,
                
'pubdate' => formatTimestamp($story->published(), 'rss') ,
                
'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES))));
        }
    }
}
$tpl->display('db:system_rss.html');
?>


if i use xnews and clone it and name the module
with the name information

what do i need to change in the backend code above ?
I Love Xoops

2
ghia
Re: xnews and backend.php
  • 2010/5/13 10:37

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Everything in the last two if blocks!
First includes the news article class and retrieves the stories.
Second adds the relevant data of the found objects to the template.
Don't know how related and similar the code of module xNews and News are.

3
noo-b
Re: xnews and backend.php
  • 2010/5/13 10:46

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


i tried this...but not working

/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 *  Xoops Backend
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         kernel
 * @since           2.0.0
 * @author          Kazumi Ono 
 * @version         $Id$
 */
include dirname(__FILE__) . DIRECTORY_SEPARATOR 'mainfile.php';

$GLOBALS['xoopsLogger']->activated false;
if (
function_exists('mb_http_output')) {
    
mb_http_output('pass');
}
header('Content-Type:text/xml; charset=utf-8');

include_once 
$GLOBALS['xoops']->path('class/template.php');
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
if (!
$tpl->is_cached('db:system_rss.html')) {
    
xoops_load('XoopsLocal');
    
$tpl->assign('channel_title'XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
    
$tpl->assign('channel_link'XOOPS_URL '/');
    
$tpl->assign('channel_desc'XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    
$tpl->assign('channel_lastbuild'formatTimestamp(time(), 'rss'));
    
$tpl->assign('channel_webmaster'checkEmail($xoopsConfig['adminmail'], true));
    
$tpl->assign('channel_editor'checkEmail($xoopsConfig['adminmail'], true));
    
$tpl->assign('channel_category''Article');
    
$tpl->assign('channel_generator''XOOPS');
    
$tpl->assign('channel_language'_LANGCODE);
    
$tpl->assign('image_url'XOOPS_URL '/images/logo.png');
    
$dimention getimagesize(XOOPS_ROOT_PATH '/images/logo.png');
    if (empty(
$dimention[0])) {
        
$width 88;
    } else {
        
$width = ($dimention[0] > 144) ? 144 $dimention[0];
    }
    if (empty(
$dimention[1])) {
        
$height 31;
    } else {
        
$height = ($dimention[1] > 400) ? 400 $dimention[1];
    }
    
$tpl->assign('image_width'$width);
    
$tpl->assign('image_height'$height);
    if (
file_exists($fileinc $GLOBALS['xoops']->path('modules/information/class/class.newsstory.php'))) {
        include 
$fileinc;
        
$sarray NewsStory::getAllPublished(100true);
    }
    if (!empty(
$sarray) && is_array($sarray)) {
        foreach (
$sarray as $story) {
            
$tpl->append('items', array(
                
'title' => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)) ,
                
'link' => XOOPS_URL '/modules/information/article.php?storyid=' $story->storyid() ,
                
'guid' => XOOPS_URL '/modules/information/article.php?storyid=' $story->storyid() ,
                
'pubdate' => formatTimestamp($story->published(), 'rss') ,
                
'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES))));
        }
    }
}
$tpl->display('db:system_rss.html');
?>
I Love Xoops

4
ghia
Re: xnews and backend.php
  • 2010/5/13 13:01

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Any debug messages? Comment
$GLOBALS['xoopsLogger']->activated false;
out to see!

5
noo-b
Re: xnews and backend.php
  • 2010/5/13 23:27

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


change it true and i get this


XML Parsing Errorno element found
Location
http://y/backend.php
Line Number 1Column 1:
I Love Xoops

6
ghia
Re: xnews and backend.php
  • 2010/5/14 0:37

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Why don't you use /modules/xnews/backendt.php?

7
btesec
Re: xnews and backend.php
  • 2010/5/14 14:38

  • btesec

  • Friend of XOOPS

  • Posts: 623

  • Since: 2007/2/20


good amount of fixes here. Probably there shuld be an updated release. I like the module's concept

8
noo-b
Re: xnews and backend.php
  • 2010/5/17 11:15

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


i try to use it..i got blank page with no eror


Quote:

ghia wrote:
Why don't you use /modules/xnews/backendt.php?
I Love Xoops

9
timgno
Re: xnews and backend.php
  • 2011/2/5 0:46

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


I receved this error with FeedBurner:
URLhttp://www.txmodxoops.org/modules/xnews/backendt.php

The URL does not appear to reference a valid XML file.


rewrite_url used



10
voltan
Re: xnews and backend.php
  • 2011/2/5 5:00

  • voltan

  • Theme Designer

  • Posts: 724

  • Since: 2006/12/5


I think we must development this part . some modules have RSS out put and backendt.php must support all of them

Login

Who's Online

465 user(s) are online (329 user(s) are browsing Support Forums)


Members: 0


Guests: 465


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits