Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=77860
Postga havola
Akbarali [2384] [off]
#10 qo`shimcha kodni headga yozmaganingiz maqul. Odatta katta dasturchilar kodlarni pastga eng.php ga yozadi sababi sahifani yuklash bir oz og`ilashishi mumun. Iloji bo`lsa php funksiyalar orqali ishlang. Shunda istagan joydasgi habarni o`nata olasiz + avomatlashtirib.
Misol
End.phpning tugash qismida
yozasiz
/incfiles/core.php ga buni yozasiz.
shunday qilib yozasiz.
Endi siz yangliklarni jo`natmoqchi bo`lsangiz hohlagan joyga yozing
yozasiz Test qilib ko`rmadim
Misol
End.phpning tugash qismida
<script type="text/javascript" > switch ( Notification.permission.toLowerCase() ) { case "granted": // можно break; case "denied": // нельзя break; case "default": // спросить } var currentPermission; Notification.requestPermission( function(result) { currentPermission = result } );
yozasiz
/incfiles/core.php ga buni yozasiz.
function jsnotif($nomi,$matni,$rasmi) { echo '<script type="text/javascript"> var mailNotification = new Notification("'.$nomi.'", { tag : "ache-mail", body : "'.$matni.'", image : "'.$rasmi.'" }); </script>'; }
shunday qilib yozasiz.
Endi siz yangliklarni jo`natmoqchi bo`lsangiz hohlagan joyga yozing
<?php $nomi = '';//Yanglikning nomi kiritilgan o`zgaruvchini yozing $matni = '';//Yanglikning matni saqlangan o`zgaruvchini yozing $rasmi = '';//Yanglikning rasmi saqlangan o`zgaruvchini yozing if ($jsnotif > 0): ?> <?=jsnotif($nomi,$matni,$rasmi);?> <?php endif;?> <?php endif;?> <div class="list2"> <form action="#" method="post"> <input type="checkbox" name="jsnotif" value="jsnotif"> <label> Foydalanuvchilarga jsda bildirishnima jo`natish</label><br/> </form> <input type="submit" name="submit" value="Submit"/> </div><!-- end row --> </div>
yozasiz Test qilib ko`rmadim