Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [html/php] Walidacja vs <meta http-equiv='Refresh' content='
Jarod
post
Post #1





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

Ostrzeżenie: (0%)
-----


Mam następujący problem. Potrzebuję w skrypcie przekierować użytkownika na jakąś stronę. Jeśli mogę to używam header.

Ale czasami potrzebuję przekierować po upływie np 3 sekund. W tym celu zastosowałem coś takiego:

Kod
<meta http-equiv='Refresh' content='3; url=index.php' />


Niestety walidator się pluje;
Cytat
Line 21 column 481: document type does not allow element "meta" here.

...='Refresh' content='3; url=index.php' />

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


Jak obejść ten problem?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
siemakuba
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 112
Pomógł: 20
Dołączył: 10.04.2005

Ostrzeżenie: (0%)
-----


delikatna podpowiedź: najpierw wykonaj wszystkie operacje które sprawdzają te historie z uzytkownikiem, a potem na podstawie ich wyniku decyduj co dalej robić - wyświetlać HTML czy przekierowywać.

Z taką zupą w kodzie z każdym dodaniem czegokolwiek będzie coraz gorzej... przemyśl reorganizację skryptów.

Delikatna podpowiedź nr2: zamiast robić wszędzie echo, zbieraj ten kod HTML do zmiennej, i wyświetlaj na koniec. To już sopro uprości, będziesz np. mógł zrobić przekierowanie w php za pomocą header w dowolnym miejscu nie martwiąc się o to czy już wysłałeś nagłówki czy nie.

Aha, co ma dać te opóźnienie czasowe? Że user będzie musiał sobie poczekać? Nie potrafię sobie tego jakoś wyobrazić...

pozdr.
Go to the top of the page
+Quote Post
Jarod
post
Post #3





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

Ostrzeżenie: (0%)
-----


Cytat(siemakuba @ 18.06.2006, 22:43 ) *
Aha, co ma dać te opóźnienie czasowe? Że user będzie musiał sobie poczekać? Nie potrafię sobie tego jakoś wyobrazić...


To, że będzie mógł przeczytć komunikat błędu zanim zostanie przekierowany na stronę logowania
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 1.10.2025 - 06:01