Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] zmiana tła na stronie w zależności od ID
Forum PHP.pl > Forum > Przedszkole
anyzs
Witam.

Jestem nowym i zielonym programistom w PHP



Mam sobie pliczek index.php a w nim :


Kod
<body>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<?php


if($_GET['id1']=="6") include("include/topa.php");
else {

include("include/top.php"); }


include("include/leftmenu.php");
?>
<th width="740" align="center" valign="top" bgcolor="#FFFFFF" scope="col">
<?php
include("center/$item.php");
?>
</th>
</tr>
<?php
include("include/footer.php");
?>
</table>
</body>



I teraz tak, chciałem aby na jednej podstronie było inne tło w jednej z tabel i po poszukiwaniach tutoriali wymyśliłem i dodałem :


Kod
if($_GET['id1']=="6") include("include/topa.php");
else {

include("include/top.php"); }

?>


ale mam teraz proble, gdyż strona nie wyświetla się od samej góry czyli nie działa mi CSS:

Kod
body
{
background-color: #FFFFFF;
margin-top: 0px;
}


Proszę o wyrozumiałość i o pomoc

Z góry dziękuję
mlawnik
STFW i znaczniki CODE

$_GET
anyzs
hmmm nie bardzo rozumiem. dodam tylko, że skopiowałem całą zawartość pliku top.php do pliku topa.php zmieniłem tylko nazwę pliku (jest w tym samym katalogu to tło z pliku top.php sad.gif
korex
rozumiem ze tło jest ustawiane w CSS?
anyzs
to mój kod CSS:
Kod
body
{
        background-color: #FFFFFF;
        margin-top: 0px;
}
        
a.loga:link
{
    text-decoration:none;
}

a.loga:visited
{
    text-decoration:none;
}

a.loga:active
{
    text-decoration:none;
}

a.loga:hover
{
    text-decoration:none;
}

#modernbricksmenu
{
    padding: 0;
    width: 100%;
    background: transparent;
    voice-family: "\"}\"";
    voice-family: inherit;
}

#modernbricksmenu ul
{
    font: bold 11px Arial;
    margin:0;
    margin-left: 0px; /*margin between first menu item and left browser edge*/
    padding: 0;
    list-style: none;
}

#modernbricksmenu li
{
    display: inline;
    margin: 0 2px 0 0;
    padding: 0;
    text-transform:uppercase;
}

#modernbricksmenu a
{
    float: left;
    display: block;
    color: white;
    margin: 0 1px 0 0; /*Margin between each menu item*/
    padding: 5px 10px;
    text-decoration: none;
    letter-spacing: 1px;
    background-color: #CC0000; /*Default menu color*/
    border-bottom: 0px solid white;
}

#modernbricksmenu a:hover
{
    background-color: #990000; /*Menu hover bgcolor*/
}

#modernbricksmenu #current a
{
/*currently selected tab*/
    background-color: #D25A0B; /*Brown color theme*/
    border-color: #D25A0B; /*Brown color theme*/
}

#modernbricksmenuline
{
    clear: both;
    padding: 0;
    width: 100%;
    height: 15px;
    line-height: 1px;
    background: #CC0000; /*Brown color theme*/
}

#myform
{
/*CSS for sample search box. Remove if desired */
    float: right;
    margin: 0;
    padding: 0;
}

#myform .textinput
{
    width: 190px;
    border: 1px solid gray;
}

#myform .submit
{
    font: bold 11px Verdana;
    height: 22px;
    background-color: lightyellow;
}

.markermenu
{
    width: 170px; /*width of menu*/
}

.markermenu ul
{
    list-style-type: none;
    margin: 5px 0;
    padding: 0;
    border: 0px solid #9A9A9A;
}

.markermenu ul li a
{
    background: white url(/media/arrow-list.gif) no-repeat 2px center;
    font: bold 13px "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, sans-serif;
    color: #CC0000;
    display: block;
    width: auto;
    padding: 3px 0;
    padding-left: 20px;
    text-decoration: none;
    border-bottom: 0px solid #B5B5B5;
}


* html .markermenu ul li a
{
/*IE only. Actual menu width minus left padding of LINK (20px) */
    width: 150px;
}

.markermenu ul li a:visited, .markermenu ul li a:active
{
    color: #CC0000;
}

.markermenu ul li a:hover
{
    color: white;
    background-color: #CC0000;
    background-image:url(/media/arrow-list-red.gif); /*onMouseover image change. Remove if none*/
}

/* Holly Hack for IE \*/
* html .markermenu ul li { height: 1%; }
* html .markermenu ul li a { height: 1%; }

.style6
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000000;
    font-weight: lighter;
    line-height: 20px;
}

body,td,th
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

.style7
{
    color: #CCCCCC
}

.style11
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000000;
    font-weight: bold;
    line-height: 20px;
}

div.formul
{
    margin: 10px 0 0 15px;
    font-size: 12px;
    color: #666666;
    text-align: left;
}

legend
{
    color: #FFFFFF;
    background-color: #808080;
    font-size: 11px;
    padding: 5px 20px;
    text-align: center;
    margin: 0 0 0 10px;
}

fieldset
{
    border: 1px solid #999999;
}

input.ok
{
    border: 1px solid #DCDCDC;
}

textarea.ok
{
    border: 1px solid #DCDCDC;
}

input.notok
{
    border: 1px solid #C10001;
}

textarea.notok
{
    border: 1px solid #C10001;
}

.center
{
    text-align: center;
}

span.color
{
    color: #CC0000;
}

div.warning
{
    padding: 10px;
    background-color: #CC0000;
    color: #FFFFFF;
    font-size: 12px;
    margin: 0 0 10px 0;
}

div.confirm
{
    margin: 30px 0 100px 0;
    color: #666666;
    font-size: 24px;
    font-weight: normal;
    text-align: center;
}

.lista_referencyjna {
    width: 350px;
    height: 200px;
    resize: both;
    overflow: auto;
    font-family: Verdana;
    font-size: 12px;
    color: #000000;
    font-weight: lighter;
    line-height: 20px;
}

a.lista_referencyjna:link {
    text-decoration: none;
    color: #000000;
}

a.lista_referencyjna:visited {
    text-decoration:none;
    color: #000000;
}

a.lista_referencyjna:active {
    text-decoration:none;
    color: #000000;
}

a.lista_referencyjna:hover {
    text-decoration:none;
    color: #CC0000;
}

div.contact
{
    background-image: url("/images/contact.png");
    background-repeat: no-repeat;
    padding: 15px 0 0 170px;
    margin: 0 0 0 20px;
    text-align: left;
    height: 100px;
    font-size: 13px;
    font-weight: normal;
}

span.color
{
    color: CC0000;
}





a to kod index.php

Kod
<?php

    $status1 = 'normal';
    $status2 = 'normal';
    $status3 = 'normal';    
    $status4 = 'normal';
    $status5 = 'normal';
    $status6 = 'normal';
    $status11 = 'normal';
    $status12 = 'normal';
    $status13 = 'normal';    
    $status14 = 'normal';
    $status15 = 'normal';
    $status16 = 'normal';

  $jaki_id1 = $_GET['id1'];
  if ( is_numeric( $jaki_id1 ) && ( $jaki_id1 > "0" ) )
  {
        $id1 = $jaki_id1;
    }
    else
  {
        $id1 = '1';
    }
    
    include("include/titles.php");    
    
switch( $id1 )
{    
    case '1':    $item = 'start';
                            $status1 = 'current';
                            $show_title = $meta_tit1;
                            $show_description = $meta_des1;
                            $show_keywords = $meta_key1;
                            break;
    case '2':    $item = 'str1';
                            $status2 = 'current';
                            $show_title = $meta_tit2;
                            $show_description = $meta_des2;
                            $show_keywords = $meta_key2;
                            break;
    case '3':    $item = 'str2';
                            $status3 = 'current';
                            $show_title = $meta_tit3;
                            $show_description = $meta_des3;
                            $show_keywords = $meta_key3;
                            break;
    case '4':    $item = 'str3';
                            $status4 = 'current';
                            $show_title = $meta_tit4;
                            $show_description = $meta_des4;
                            $show_keywords = $meta_key4;
                            break;
    case '5':    $item = 'str4';
                            $status3 = 'current';
                            $show_title = $meta_tit5;
                            $show_description = $meta_des5;
                            $show_keywords = $meta_key5;
                            break;
    case '6':    $item = 'str5';
                            $status3 = 'current';
                            $show_title = $meta_tit6;
                            $show_description = $meta_des6;
                            $show_keywords = $meta_key6;
                            break;
    case '7':    $item = 'str6';
                            $status3 = 'current';
                            $show_title = $meta_tit6;
                            $show_description = $meta_des6;
                            $show_keywords = $meta_key6;
                            break;                                
    case '11':    $item = 'str8';
                            $status11 = 'current';
                            $show_title = $meta_tit11;
                            $show_description = $meta_des11;
                            $show_keywords = $meta_key11;
                            break;
    case '12':    $item = 'str9';
                            $status12 = 'current';
                            $show_title = $meta_tit12;
                            $show_description = $meta_des12;
                            $show_keywords = $meta_key12;
                            break;
    case '13':    $item = 'str10';
                            $status13 = 'current';
                            $show_title = $meta_tit13;
                            $show_description = $meta_des13;
                            $show_keywords = $meta_key13;
                            break;
    case '14':    $item = 'str11';
                            $status14 = 'current';
                            $show_title = $meta_tit14;
                            $show_description = $meta_des14;
                            $show_keywords = $meta_key14;
                            break;
    case '15':    $item = 'str12';
                            $status15 = 'current';
                            $show_title = $meta_tit15;
                            $show_description = $meta_des15;
                            $show_keywords = $meta_key15;
                            break;
    case '16':    $item = 'str13';
                            $status16 = 'current';
                            $show_title = $meta_tit16;
                            $show_description = $meta_des16;
                            $show_keywords = $meta_key16;
                            break;
    default:         $item = 'start';
                            $status1 = 'current';
                            $show_title = $meta_tit1;
                            $show_description = $meta_des1;
                            $show_keywords = $meta_key1;
                            break;    
}    
    include("include/head.php");

    if ( $_GET['utm_source'] == 'google' )
{
    $data = date("Y-m-d");
    $czas = date("H:i:s");
  $ip = $_SERVER["REMOTE_ADDR"];
    $host = gethostbyaddr($ip);
    $przegladarka = $_SERVER["HTTP_USER_AGENT"];    
    $utm_source = $_GET['utm_source'];
    $utm_medium = $_GET['utm_medium'];
    $utm_campaign = $_GET['utm_campaign'];
    $utm_term = $_GET['utm_term'];
    $uri = $_SERVER['REQUEST_URI'];
    
    $connection = @mysql_connect('localhost', 'admins', '****')
        or die('Brak połączenia z serwerem MySQL');
  $db = @mysql_select_db('admins', $connection)
        or die('Nie mogę połączyć się z bazą danych');    
    
    $ins = @mysql_query("INSERT INTO ip SET
        data='$data',
        czas='$czas',
        ip='$ip',
        host='$host',
        przegladarka='$przegladarka',
        utm_source='$utm_source',
        utm_medium='$utm_medium',
        utm_campaign='$utm_campaign',
        utm_term='$utm_term',
        uri='$uri'
        ");
    $id = mysql_insert_id();
  mysql_close($connection);    
}    
?>
<body>
<table width="910" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<?php    
    include("include/top.php");
    include("include/leftmenu.php");
?>
       <th width="740" align="center" valign="top" bgcolor="#FFFFFF" scope="col">
<?php
                include("center/$item.php");
?>                
            </th>
  </tr>
<?php    
    include("include/footer.php");
?>
</table>
</body>
</html>
korex
z bledow rzucających sie w oczy to brak otwarcia znacznika <html>, spróbuj ustawić sobie jakąś ramkę dla body i zobacz czy nic nie wychodzi ponad górną krawędź ew. spróbuj ustawiać margines górny na np. -10px i zobacz czy się podniesie.
anyzs
ok, wywaliłem </html> i jak ustawiałem margines na "-" to wszystko jechało mi do góry, tzn kaŻda podstrona
korex
trudno coś więcej powiedzieć na temat strony której nie widzę... próbuj tych marginesów i włącz sobie narazie ramki (border: 1px solid black;) to ułatwi Ci to prace.
anyzs
ok, thx. jutro powalcze specool.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.