1
timgno
Xoops 2.5.x Functions
  • 2011/11/18 18:56

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


xoops_getmodulehandler function should not work anywhere?

works only in the modules and not in the files of root

2
trabis
Re: Xoops 2.5.x Functions
  • 2011/11/18 21:47

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

timgno wrote:
xoops_getmodulehandler function should not work anywhere?

works only in the modules and not in the files of root


Sure it does, but you have to specify the second argument (the one for module dirname).

$field_handler = xoops_getmodulehandler('field', 'profile');

3
timgno
Re: Xoops 2.5.x Functions
  • 2011/11/18 22:18

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


I know this but, I don't understand why don't receive data from the database.

If I use the class criteria in the same code modules, it work, and while the function mentioned above, I use any file in the root, does not receive data.

Why?

Xoops 2.5.3

4
trabis
Re: Xoops 2.5.x Functions
  • 2011/11/18 22:52

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


ok, from the code you sent by pm I can see you are using index.php which renders system_homepage.html template

That template has a cache time set in header.php (look inside).

What is happening is that you are hiting the cache and the code after header.php is not being executed at all.

Now, you should not change the code in header.php, you can disable the cache using preloads.

Create a new preload and add this code inside:
function eventCoreHeaderCheckcache($args)
    {
        if ((!empty(
$GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] == 'db:system_homepage.html')) {
            
$GLOBALS['xoTheme']->contentCacheLifetime 0;
        }
    }


This code will disable cache on front page.

5
timgno
Re: Xoops 2.5.x Functions
  • 2011/11/18 22:59

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


Thanks for the code!

I try then let you know

6
timgno
Re: Xoops 2.5.x Functions
  • 2011/11/18 23:12

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


If set to zero, I always error

7
trabis
Re: Xoops 2.5.x Functions
  • 2011/11/18 23:34

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


If you have errors, please post them, along with the code.

I'm not sure how can I help you. Perhaps you should forget preloads for now, just change header.php
$xoTheme->contentCacheLifetime = 604800;
into
$xoTheme->contentCacheLifetime = 0;

hum,
If you are including module files from the root, and if those included files are including other files using relative paths such as '../myfile.php', then you are not including the files at all. use always dirname(__FILE__) for file inclusions.

Better yet, use chdir('modules/xnews') to make your file includes work.

8
timgno
Re: Xoops 2.5.x Functions
  • 2011/11/18 23:50

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


I tried changing:

header.php
$ xoTheme-> contentCacheLifetime = 604800;
into
$ xoTheme-> contentCacheLifetime = 0;

but the same error:

A problem has occurred on our server!

Page is currently unavailable

We are working on a fix
Please come back soon ...
Error : Handler does not exist
Module: xnews
Name: nw_stories



9
trabis
Re: Xoops 2.5.x Functions
  • 2011/11/19 0:17

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Is there a file named xnews/class/nw_stories.php with a class of XnewsNw_storiesHandler inside?

The error says no.

10
timgno
Re: Xoops 2.5.x Functions
  • 2011/11/19 0:43

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


the file class is xnews/class/class.newsstory.php

The handler class did not exist and I created myself, like this:

class xnewsnw_storiesHandler extends XoopsPersistableObjectHandler
{
    function 
__construct($db)
    {
        
parent::__construct($db'xnews''nw_stories'"storyid""topicid");
        
$this->className 'nw_NewsStory';
    }
}

Login

Who's Online

188 user(s) are online (118 user(s) are browsing Support Forums)


Members: 0


Guests: 188


more...

Donat-O-Meter

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

Latest GitHub Commits