xmas12 Posted March 29, 2009 Report Share Posted March 29, 2009 Sveiki! Es taisu web lapu kur izmantoju switch funkciju lai links butu savaadaks :) . Switch funkcija man stav index.php failaa. Un virs tas funkcijas es ievietoju cutenews scriptu lai varetu redzet jaunumus. Bilde: Un kad ieeju kur rada kaadi lietotaji ir online tad man tas cutenews radas virs online lietotajiem .( wtf?) . Bilde Bet es gribu lai jaunumi tikai radas index lapakad ieej webaa nevis kad ej visu piemeram vestules lietotaju profili un visur radas tie juanumi virs ta ko nolasa switch funkcija. Varbut varesiet palidzet. Reku kods kads man stav ar switch un jaunumu script. <div id="saturs"> </div> <?php include("cutenews/show_news.php"); ?> <?php if(isset($_GET['lapa'])) { switch($_GET['lapa']) { case 'profils': include("switch/profils.php"); break; case 'forums': include("switch/forums.php"); break; case 'fails': include("switch/faili.php"); break; case 'profiles': include("switch/profiles.php"); break; } } ?> <div id="lapasspuses"></div> Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 29, 2009 Report Share Posted March 29, 2009 (edited) 1. nomaini topika nosaukumu uz sakariigaku !!! 2. kart... .. switch ($sadalja) { case 'xx1': $contents='xxx1.php'; break; case 'xx2': $contents='xxx2.php'; break; default: $contents='xxx3.php'; } ... te turpinaas PHP kods ?> <htm> te html haideris utt ... te vieta kur jaincludo <?php include ($contents); ?> turpinas html sadi ir daudz labaak, jo daudzmaz PHP tiek atdaliits no HTML Edited March 29, 2009 by Grey_Wolf Link to comment Share on other sites More sharing options...
xmas12 Posted March 29, 2009 Author Report Share Posted March 29, 2009 1. nomaini topika nosaukumu uz sakariigaku !!!2. kart... .. switch ($sadalja) { case 'xx1': $contents='xxx1.php'; break; case 'xx2': $contents='xxx2.php'; break; default: $contents='xxx3.php'; } ... te turpinaas PHP kods ?> <htm> te html haideris utt ... te vieta kur jaincludo <?php include ($contents); ?> turpinas html sadi ir daudz labaak, jo daudzmaz PHP tiek atdaliits no HTML Nomainiju, uzliku tavu kodu bet tapat nemainijas to ko man vajag izlabot :( Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 29, 2009 Report Share Posted March 29, 2009 nu bet to pirmo incluudi novaac nost ... savadak tev sanak ka includojas, un pec tam, ja vajag inclodojas otreiz. Pirmo includi ieliec kaa defolto ... tas arii viss.. un izcludo visu vienaa vietaa, tb vietaa kur buus pats saturs. + teiksim ja katrei ir cits menu, tad vari tajaa svichaa pielikt kadu menu jainclodo & teiksim lapas <title> nosukumu pamainiit, .. utt... respektiivi sakumaa uzzini kas un kur janovieto un talak tikai ievieto --> HtML tiek adaliits no PHP ... Ieguvums ir liels, viegli mainiit dizainu, viegli lasiit kodu utt... Link to comment Share on other sites More sharing options...
xmas12 Posted March 31, 2009 Author Report Share Posted March 31, 2009 Visu salaboju ! SLEGTS!!!! Link to comment Share on other sites More sharing options...
Recommended Posts