News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

$ssi_on_error_method

Started by danwsc, March 30, 2012, 11:19:00 AM

Previous topic - Next topic

danwsc

I found the following code in SSI.php


/* 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.

Masterd

I don't exactly undestand you. What you are trying to do?

danwsc

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.

Kays

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

danwsc

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.

Kays

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

weimer

I am writing an app targeted for mobile phones.

kat

Quote from: weimer on April 05, 2012, 10:57:13 AM
I am writing an app targeted for mobile phones.

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

Hammer time! :)

ascaland

#8
Quote from: danwsc 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.

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.

Advertisement: