vitao.web Posted January 12, 2010 Report Share Posted January 12, 2010 (edited) Ja kādam vajag, var izmantot šo banera rotācijas skriptu viss iet pareizi! <?php // Nejaus skaitlis no 1 - 100 $result_random=rand(1, 100); // ja rezultats ir mazaks vai vienads ar 70, tad parada banneri nr1 (70%) if($result_random<=70){ echo "Parada banneri nr1"; } // ja rezultats ir mazaks vai vienads ar 90, tad parada banneri nr2 (20%) elseif($result_random<=90){ echo "Parada banneri nr2"; } // ja rezultats ir mazaks vai vienads ar 100, tad parada banneri nr3 (10%) elseif($result_random<=100){ echo "Parada banneri nr3"; } ?> Edited January 12, 2010 by vitao.web Quote Link to comment Share on other sites More sharing options...
briedis Posted January 12, 2010 Report Share Posted January 12, 2010 ir kādi kļūdu paziņojumi? Kodā kļūdu it kā nav... Quote Link to comment Share on other sites More sharing options...
vitao.web Posted January 12, 2010 Author Report Share Posted January 12, 2010 (edited) ir kādi kļūdu paziņojumi? Kodā kļūdu it kā nav... Es ielieku weba itka ieksa, atstaju tos pasus echo "Parada banneri nr1"; , kur pec idejas vajadzeja paradit vnk tekstu Parada banneri nr1 vai nr2 vai n3, bet nekas nenotiek.. Ieliku vienkāršā baltā lapā, tad viss iet, jaskatās kaut kas ar css un html ... Edited January 12, 2010 by vitao.web Quote Link to comment Share on other sites More sharing options...
briedis Posted January 12, 2010 Report Share Posted January 12, 2010 Es ielieku weba itka ieksa, atstaju tos pasus echo "Parada banneri nr1"; , kur pec idejas vajadzeja paradit vnk tekstu Parada banneri nr1 vai nr2 vai n3, bet nekas nenotiek.. Ieliku vienkāršā baltā lapā, tad viss iet, jaskatās kaut kas ar css un html ... Neviens cits skripts lapā nav? Uzliec pašas lapas sākumā: ini_set("display_errors",1); Quote Link to comment Share on other sites More sharing options...
vitao.web Posted January 12, 2010 Author Report Share Posted January 12, 2010 (edited) Viss aizgaja ta pat :) Truka vien ";" semicols :P Edited January 12, 2010 by vitao.web Quote Link to comment Share on other sites More sharing options...
2easy Posted January 12, 2010 Report Share Posted January 12, 2010 beigās tač nevajag nekādu elseif pietiek ar vnk else else{ echo "Parada banneri nr3"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.