Forums / Cotonti / Core Labs / Archive / Redirect timer?

musiconly
#1 2009-04-05 00:37
I have a suggestion for errors which have redirects..

How about adding a simple countdown to that errors so the user would know that he will be redirected in a short amount of time.

For example:

An error occured, maybe a wrong URL ?

Redirecting in 5 seconds


What you think?
robofreak111
#2 2009-04-05 01:06
So it would be like:
An error occured, maybe a wrong URL ?

Redirecting in 5 seconds

and then 1 second later the 5 would turn into a 4? that really woulndt be too hard...
TwistedGA
#3 2009-04-05 03:29
The way error message redirection works is through the use of META tags. In it's current state, you can do this very easily. The countdown will need to be implemented, but showing the user the seconds, only takes editing two lines in the message.inc.php.

Replace the 2(Two) instances of:
	$body .= "<br />&nbsp;<br />".$L['msgredir'];

First instance:
	$body .= "<br />&nbsp;<br />".$L['msgredir']." 2 ".$L['Seconds']." ";

Second instance:
	$body .= "<br />&nbsp;<br />".$L['msgredir']." ".$rd." ".$L['Seconds']." ";

I can work on the countdown if you think it would be worth it. :-)

Well, I'm bored and wanted something new to do. I'm sure theres a better method for this, but a working countdown can be added using these two instead of the ones above.

First Instance:
	$body .= "
        <br />&nbsp;<br />".$L['msgredir']." 2 ".$L['Seconds']." 
        <script>
                var milisec=0
                var seconds=3
                document.getElementById(\"d2\").innerHTML=\"3\";

                function display(){
                         if (milisec<=0){
                         milisec=9
                         seconds-=1
                }
                if (seconds<=-1){
                milisec=0
                seconds+=1
                }
                else
                milisec-=1
                document.getElementById(\"d2\").innerHTML=seconds;
                setTimeout(\"display()\",100)
                }
                display()
        </script>"

Second Instance:
	$body .= "
        <br />&nbsp;<br />".$L['msgredir']." <label id=\"d2\">".$rd."</label> ".$L['Seconds']."
        <script>
                var milisec=0
                var seconds=$rd+1
                document.getElementById(\"d2\").innerHTML=\"$rd+1\";

                function display(){
                         if (milisec<=0){
                         milisec=9
                         seconds-=1
                }
                if (seconds<=-1){
                milisec=0
                seconds+=1
                }
                else
                milisec-=1
                document.getElementById(\"d2\").innerHTML=seconds;
                setTimeout(\"display()\",100)
                }
                display()
        </script>";
[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]

Dit bericht is bewerkt door TwistedGA (2009-04-05 03:56, 14 jaren ago)
gamer24.7
#4 2009-04-16 17:48
Where are the instances in message.inc.php?
[b][color=#000000]Click [/color][url=http://www.design-studio.netau.net][color=#EF2929][u]Here[/u][/color][/url] [color=#F57900]For All You Design [/color][color=#756745]Related Needs.[/color][/b]
pieter
#5 2009-04-16 18:02
\system\core\message\

1st instance: line 154
2nd instance: line 164

I tried it, first one works, but not the countdown.
Some error in the script. Some " are missing I guess.

For me he displays 2 seconds. Can I change it?
... can we help you ...

Dit bericht is bewerkt door pieter (2009-04-16 18:09, 14 jaren ago)
oc
#6 2009-04-16 21:11
Obsolete.
pieter
#7 2009-04-16 21:19
What do you mean OC?
Is this standard in new version?

I guess: http://trac.cotonti.com/ticket/266
... can we help you ...

Dit bericht is bewerkt door pieter (2009-04-16 21:21, 14 jaren ago)