Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> REQUEST_URI
PawelGawel
post 21.04.2010, 08:35:42
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 28.09.2006

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


Witam
mam taki kawałek kodu który w wordpressowym szablonie odpowiedzialny jest za zmianę zdjęcia w topie
wszystko działa bez zarzutu do momentu kiedy REQUEST_URI prowadzi do jednej ze storn głównych (tzn tych dostępnych w głównym menu)
poniższy kod nie działa w przypadku podstron (/przedszkole/przedszkole1/" i /przedszkole/przedszkole2/"), ktoś może mi wyjaśnić dla czego??
zaznaczam że ścieżki są poprawne

Kod
<?php
        if (strstr($_SERVER['REQUEST_URI'], "/windsurfing/")) {
            $tab = 1;
            $bg_foto = "wind";
        } elseif (strstr($_SERVER['REQUEST_URI'], "/kitesurfing/")) {
            $tab = 2;
            $bg_foto = "kite";            
        } elseif (strstr($_SERVER['REQUEST_URI'], "/przedszkole/")) {
            $tab = 3;
            $bg_foto = "surfek4";    
        } elseif (strstr($_SERVER['REQUEST_URI'], "/przedszkole/przedszkole1/")) {
            $tab = 4;
            $bg_foto = "surfek2";    
        } elseif (strstr($_SERVER['REQUEST_URI'], "/przedszkole/przedszkole2/")) {
            $tab = 5;
            $bg_foto = "surfek3";    
        } elseif (strstr($_SERVER['REQUEST_URI'], "/snowboarding/")) {
            $tab = 7;
            $bg_foto = "snow";
        } elseif (strstr($_SERVER['REQUEST_URI'], "/kontakt/")) {
            $bg_foto = "kontakt";
        } elseif (strstr($_SERVER['REQUEST_URI'], "/o-nas/")) {
            $bg_foto = "onas";
        } else {
            $tab = 0;
            $bg_foto = "news";
        }
    ?>


<div id="header" style="background: url('<?php bloginfo('stylesheet_directory'); ?>/images/headers/<?php print $bg_foto; ?>60.jpg');">
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 09:13