1
dragonfl
can this be done?
  • 2004/3/1 12:18

  • dragonfl

  • Just popping in

  • Posts: 16

  • Since: 2003/10/6


I am wondering if it is possable to do this..

I am working on a couple of modules for my site, and am wondering if you can make a call to the template file from within a function statement?

ie.

function start()
{
$xoopsOption['template_main'] = "add_raid.html";
}

 if(!isset(
$HTTP_POST_VARS['op'])) {
        
$op = isset($HTTP_GET_VARS['op']) ? $HTTP_GET_VARS['op'] : 'main';
} else {
        
$op $HTTP_POST_VARS['op'];
}
        switch (
$op) {
        case 
'add_editB':
        
add_editbank();
        break;
        case 
'addbank':
        
addbank();
        break;
        case 
'delbank':
        
deletebank();
        default:
        case 
'main':
        default:
        
start();
        break;
}


now this is just a snipit of the code

Thanks Dragon

2
dragonfl
Re: can this be done?
  • 2004/3/3 15:16

  • dragonfl

  • Just popping in

  • Posts: 16

  • Since: 2003/10/6


bump.

-sorry-
does anyone know if this can be done, because all I get is a black page and no debug info when I try


Dragonfl

3
Mithrandir
Re: can this be done?

Should be possible, if you put a
global $xoopsOption;

at the beginning of the function

4
Dave_L
Re: can this be done?
  • 2004/3/3 15:52

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I would also change:

if(!isset($HTTP_POST_VARS['op'])) {
        
$op = isset($HTTP_GET_VARS['op']) ? $HTTP_GET_VARS['op'] :
'main';
} else {
        
$op $HTTP_POST_VARS['op'];
}


to:



if (isset($HTTP_POST_VARS['op'])) {
   
$op $HTTP_POST_VARS['op'];
} elseif (isset(
$HTTP_GET_VARS['op'])) {
   
$op $HTTP_GET_VARS['op'];
} else {
   
$op 'main';
}


Also, there are two instances of "default:" in the switch construct. The first one should be "break;".

5
dragonfl
Re: can this be done?
  • 2004/3/3 16:19

  • dragonfl

  • Just popping in

  • Posts: 16

  • Since: 2003/10/6


Thanks guys, whe I get home and am able to access my server I will try these to see if they work..

Dragonfl

6
Mithrandir
Re: can this be done?

If you want to support future developments rather than backwards compatibility, go with $_POST and $_GET instead of $HTTP_POST_VARS and $HTTP_GET_VARS - introduced in PHP 4.1.0 IIRC

Login

Who's Online

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


Members: 0


Guests: 118


more...

Donat-O-Meter

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

Latest GitHub Commits