GraaBeklis Posted May 8, 2005 Report Share Posted May 8, 2005 (edited) Man ir uztaisiits ka ir 3 veidu krasu dizaini, kuri ir taisiti ar css.. izskati.php man ir taa: <a href="?style=1">Dzeltens</a> <a href="?style=2">Zals</a> <a href="?style=3">Sarkans</a> Un ka nospiezh piem uz Sarkans lai vinjsh man kaa defaulto uzliek sarkans.css, kaa to izdariit? plzz paliidziet=] Edited May 8, 2005 by GraaBeklis Link to comment Share on other sites More sharing options...
bubu Posted May 8, 2005 Report Share Posted May 8, 2005 if'u nemākam vairs rakstīt: if ($_GET['style']=='3') { echo '<link href="sarkans.css" rel="stylesheet" type="text/css"/>'; } Neaizmirstam tikai par isset() Link to comment Share on other sites More sharing options...
GraaBeklis Posted May 8, 2005 Author Report Share Posted May 8, 2005 Hmm.. ko man ar to isset jadara??? Link to comment Share on other sites More sharing options...
hmnc Posted May 8, 2005 Report Share Posted May 8, 2005 Hmm.. ko man ar to isset jadara??? 17291[/snapback] jāpalasa manuālis. ja tas nepalīdz tad jāmet pie malas programmēšana. nu nav tas priekš tevis!! :) Link to comment Share on other sites More sharing options...
Garais333 Posted May 9, 2005 Report Share Posted May 9, 2005 if (isset($_GET['style'])=='3') { echo '<link href="sarkans.css" rel="stylesheet" type="text/css"/>'; } Šitā jāieliek Link to comment Share on other sites More sharing options...
bubu Posted May 9, 2005 Report Share Posted May 9, 2005 Iz http://lv.php.net/isset : Returns TRUE if var exists; FALSE otherwise. Un kā tu domā kurā gadījumā šis TRUE/FALSE būs == 3? Link to comment Share on other sites More sharing options...
Klez Posted May 9, 2005 Report Share Posted May 9, 2005 if (isset($_GET['style'])=='3') { echo '<link href="sarkans.css" rel="stylesheet" type="text/css"/>'; } Šitā jāieliek 17330[/snapback] programeeshana arii priex tewis naw.... wismaz taa izskataas .... manuaalis tak jaalasa .... wai ja 100% nezini tad labaak nemaz neraxti .... :) Link to comment Share on other sites More sharing options...
GraaBeklis Posted May 9, 2005 Author Report Share Posted May 9, 2005 (edited) nu šitā te ka jūs man palīdzat man baig lab iespiezhas prātā, kas kā .. vaitad priekš tā nav forumi?? ;] a shitaa kautkaa neder?: <?php $style = $_GET['style']; switch($style) { case '2': setcookie ('<link href="styles/2.css" rel="stylesheet" type="text/css"/>', $style); echo 'Tu uzvēlējies: <link href="styles/1.css" rel="stylesheet" type="text/css"/>'; } ?> Tikai man raada error: Warning: Cannot add header information - headers already sent by (output started at d:\www\web\index.php:12) in d:\www\web\izskati.php on line 5 Edited May 9, 2005 by GraaBeklis Link to comment Share on other sites More sharing options...
Klez Posted May 9, 2005 Report Share Posted May 9, 2005 (edited) ir priex tam .... bet nu mauaali tachu ir skaidri uzrakxtiic un paraadiits ... piemērs no manuāļa un te buus latviski arii.... priex tiem kas manuaaljus nelasa wai negrib to dariit ... :( <?php $var = ''; // This will evaluate to TRUE so the text will be printed. if (isset($var)) { echo "This var is set set so I will print."; } $var = 'kaut kas da jebkas'; //sheit naw weertiibas mainiigajam // mainiigajam vajab pieshkirt veertiibu, tad mainiigais izvadiisies if (isset($var)) { echo "Veertiiba ir un tiek izvadiits shis txt."; } ?> Edited May 9, 2005 by Klez Link to comment Share on other sites More sharing options...
Klez Posted May 9, 2005 Report Share Posted May 9, 2005 war ariii ar switch ... :) switch($style){ case 1: echo "stils 1"; break; case 2: echo "stils 2"; break; case 3: echo "stils 3"; break; default: echo "stils 1"; } Link to comment Share on other sites More sharing options...
GraaBeklis Posted May 9, 2005 Author Report Share Posted May 9, 2005 nu man jau ar switch un case ir uztaisiits: <?php $style = $_GET['style']; switch($style) { case '1': echo '<link href="1.css" rel="stylesheet" type="text/css"/>'; break; case '2': echo '<link href="2.css" rel="stylesheet" type="text/css"/>'; break; } ?> bet vinjsh jau to stylu nomaina tikai uz to briidi kameer nav nospiesta cita izvelne.. Link to comment Share on other sites More sharing options...
bubu Posted May 9, 2005 Report Share Posted May 9, 2005 bet vinjsh jau to stylu nomaina tikai uz to briidi kameer nav nospiesta cita izvelne.. A ko tad tu sākumā prasīji, ja ne šo? Link to comment Share on other sites More sharing options...
GraaBeklis Posted May 9, 2005 Author Report Share Posted May 9, 2005 (edited) A ko tad tu sākumā prasīji, ja ne šo? 17340[/snapback] -->> ... Un ka nospiezh piem uz Sarkans lai vinjsh man kaa defaulto uzliek sarkans.css, kaa to izdariit? ... <<-- default vaitad neskaitas tjip kaa visu laiku paliekosh, liidz to nenomaina?? Aaa un pie reizes paprasiishu, kapeec man vish vislaik saka ka neiet: <?php $ip = "81.198.21.139"; if($_SERVER['REMOTE_ADDR'] == $ip) { echo ''; } else { echo 'neiet..'; exit; } ?> Edited May 9, 2005 by GraaBeklis Link to comment Share on other sites More sharing options...
Klez Posted May 9, 2005 Report Share Posted May 9, 2005 nu tad tev sesijaa jaasaglabaa vai cepums jaataisa .... <? session_start(); switch($_GET['style']){ case 1: $HTTP_SESSION_VARS['stils'] = 'zalsh'; break; case 2: $HTTP_SESSION_VARS['stils'] = 'zils'; break; case 3:$HTTP_SESSION_VARS['stils'] = 'sarkans'; break; default: $HTTP_SESSION_VARS['stils'] = 'zalsh'; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1257"> <title>Super lapa</title> <link rel="stylesheet" href="<?=$HTTP_SESSION_VARS['stils']?>.css" type="text/css"> </head> <body> Te mana super lapas paareejaa dalja </body> </html> ceru ka iebrauci :) Link to comment Share on other sites More sharing options...
Klez Posted May 9, 2005 Report Share Posted May 9, 2005 iztaisi <?=$_SERVER['REMOTE_ADDR']?> <?php $ip = "81.198.21.139"; if($_SERVER['REMOTE_ADDR'] == $ip) { echo ''; } else { echo 'neiet..'; exit; } //vienkaarshaax varinats //ja ip nebuus vienaada ar $ip tad viss apstasies if (if($_SERVER['REMOTE_ADDR'] != $ip) die("Neiet"); ?> Link to comment Share on other sites More sharing options...
Recommended Posts