Advertisement:

Author Topic: $ssi_on_error_method  (Read 1165 times)

Offline danwsc

  • Semi-Newbie
  • *
  • Posts: 22
$ssi_on_error_method
« on: March 30, 2012, 11:19:00 AM »
I found the following code in SSI.php

Code: [Select]
/* Set this to one of three values depending on what you want to happen in the case of a fatal error.
false: Default, will just load the error sub template and die - not putting any theme layers around it.
true: Will load the error sub template AND put the SMF layers around it (Not useful if on total custom pages).
string: Name of a callback function to call in the event of an error to allow you to define your own methods. Will die after function returns.
*/
$ssi_on_error_method = false;

Is there sample code out there that shows how this can be used please?

I tried substituting it for my solution to redirect the page should someone click the login button before the wait time is over and it didn't work.

Regards.

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,854
  • Gender: Male
  • Sapienti satis.
Re: $ssi_on_error_method
« Reply #1 on: March 30, 2012, 03:44:09 PM »
I don't exactly undestand you. What you are trying to do?
My Mods

Sugested that too. Hey ho. I'd link you to the original discussion but it's not visible to most people (seekrit team board stuff that is more dangerous than wikileaks).


Don't PM me for support! Use the appropriate support board!

It's the possibility of having a dream come true that makes life interesting.

Offline danwsc

  • Semi-Newbie
  • *
  • Posts: 22
Re: $ssi_on_error_method
« Reply #2 on: March 31, 2012, 09:01:05 AM »
Hi I am trying to use it.

on_error_method sounds like something that will allow customization when there is an error.
Right now I am writing an app targeted for mobile phones.
SMF's normal response to error is to use the normal SMF templates designed for the PC monitor.
I am hoping that this will allow me to make screens that can show up better on a mobile phone.

Thanks and Regards.

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: $ssi_on_error_method
« Reply #3 on: March 31, 2012, 09:17:55 AM »
Hi, just a wild guess here but I would think that you would need to use "string".

Create your own error page and call it as a function.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline danwsc

  • Semi-Newbie
  • *
  • Posts: 22
Re: $ssi_on_error_method
« Reply #4 on: April 01, 2012, 10:32:20 AM »
Yep, that's what I did.

Defined a function and put the name of the function in String.
Then clicked the login button twice in quick succession.
Normal thing happened ie. redirected to a normal SMF error screen.

So I was wondering if anybody has used it before so I could look at some code to see what else I need to do.

Regards.

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: $ssi_on_error_method
« Reply #5 on: April 04, 2012, 09:31:59 PM »
In looking at the code in Error.php that's how it does work if a fatal error is created using either the fatal_error() or fatal_lang_error() functions.

A login error is handled differently since the user gets re-sent to a login page if there's a problem.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline weimer

  • Newbie
  • *
  • Posts: 2
Re: $ssi_on_error_method
« Reply #6 on: April 05, 2012, 10:57:13 AM »
I am writing an app targeted for mobile phones.

Offline K@

  • Lead Support Specialist
  • SMF Master
  • *
  • Posts: 47,551
  • Gender: Male
  • Yum!
Re: $ssi_on_error_method
« Reply #7 on: April 05, 2012, 12:25:43 PM »
I am writing an app targeted for mobile phones.

No, you're not. You're copy/pasting other people's words.

Hammer time! :)

Offline Anthony`

  • Sophist Member
  • *****
  • Posts: 1,347
  • Gender: Male
  • Formerly Project Evolution
    • AnthonyCalandra on GitHub
Re: $ssi_on_error_method
« Reply #8 on: April 06, 2012, 10:42:02 PM »
Yep, that's what I did.

Defined a function and put the name of the function in String.
Then clicked the login button twice in quick succession.
Normal thing happened ie. redirected to a normal SMF error screen.

So I was wondering if anybody has used it before so I could look at some code to see what else I need to do.

Regards.

After experimenting a little, this isn't possible currently with what you want to do. I set the variable to my callable function in SSI.php, and attempted to spam login using the form generated by the SSI login function. After doing a bit of debugging, the SMF constant is set to 1, and the $ssi_on_error_method is actually null in the function where the callable function is supposed to be invoked.

It probably works so you can only do this when you call an error function INSIDE SSI.php, which isn't totally effective in your case.
« Last Edit: April 06, 2012, 11:38:48 PM by Project Evolution »