reGative Posted June 8, 2011 Report Share Posted June 8, 2011 Sveiki. Uzrakstīju nelielu javascript funkciju <script type='text/javascript'> function speeleet(video_id){ kods= '<object width="550" height="340"><param name="movie" value="http://www.youtube.com/v/'+video_id+'?version=3&hl=lv_LV&rel=0&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+video_id+'?version=3&hl=lv_LV&rel=0&autoplay=1" type="application/x-shockwave-flash" width="550" height="340" allowscriptaccess="always" allowfullscreen="true"></embed></object>'; document.getElementById('video_speeleet').innerHTML = kods;} </script> ir div elements, uz kura uzspiežot, parādās video. Vajadzētu funkcijā ielikt MySQL pieprasījumu, kurš izvelk video nosaukumu un aprakstu no datubāzes. Tā nebūtu problēma, ja vien varētu video_id uztaisīt par PHP mainīgo un taj embed kodā ielikt php mainīgos. Lūdzu, palīdziet. Link to comment Share on other sites More sharing options...
rATRIJS Posted June 8, 2011 Report Share Posted June 8, 2011 Man neliekas ka tu iisti zini atshkjiriibu starp PHP un JavaScript un kur tie izpildaas... Eniivei ar shiem resursiem vajadzeetu pietikt: http://api.jquery.com/category/ajax/ http://blogs.sitepoint.com/ajax-jquery/ http://www.ibm.com/developerworks/opensource/library/os-php-jquery-ajax/index.html Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 Radās ideja ,kā to funkciju savādāk uzrakstīt. Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 (edited) Pārtaisīju funkciju <script type='text/javascript'> function speeleet(video_id){ document.getElementById('video_speeleet').innerHTML=request.open("GET", 'pages/video.php?video_id='+video_id, true); } </script> video.php fails <?php$video_id = $_GET['video_id'];$kverijs = mysql_query("SELECT * FROM video WHERE video_id='$video_id'"); $video=mysql_fetch_array($kverijs);?> <div class='virsraksts'><?=$video['title']?></div> <object width="550" height="340"><param name="movie" value="http://www.youtube.com/v/<?=$video['video_id']?>?version=3&hl=lv_LV&rel=0&autoplay=1"></param> <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/<?=$video['video_id']?>?version=3&hl=lv_LV&rel=0&autoplay=1" type="application/x-shockwave-flash" width="550" height="340" allowscriptaccess="always" allowfullscreen="true"></embed></object> <div class='info'><?=$video['about']?></div> kkas nav kārtībā ar to PHP include, bet kā to uzrakstīt savādāk? Edited June 8, 2011 by reGative Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 Lūdzu, palīdziet. Dots devējam atdodas. Link to comment Share on other sites More sharing options...
xPtv45z Posted June 8, 2011 Report Share Posted June 8, 2011 Ja kaut kas nav kārtībā, tad kaut ko salabo. Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 Neesmu es vēl profesionālis. Tāpēc lūdzu palīdzību, ko te var pasākt. Link to comment Share on other sites More sharing options...
rATRIJS Posted June 8, 2011 Report Share Posted June 8, 2011 (edited) Kas ir 'request'? Javascript konsole kljuudas nemet? (paarbaudiit var ar Inspector uz Webkit paarluukiem vai Firebug uz Firefox) P.S. SQL injekcijas ir iespeejamas... P.S.S 100% tu vareeji uzrakstiit vairaak par 'kaut kas nav kaartiibaa ar php include'. Piemeeram pastaastot kas nestraadaa vai kaadas kljuudas redzi. Programmeetaaji nav ziilnieki... Edited June 8, 2011 by rATRIJS Link to comment Share on other sites More sharing options...
daGrevis Posted June 8, 2011 Report Share Posted June 8, 2011 Un programmētāji ir slinki... Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 wnk uzpiežot uz div bloka, blakus būtu jāparādās video, bet tā nenotiek, nospiežot vispār nereaģē. Link to comment Share on other sites More sharing options...
daGrevis Posted June 8, 2011 Report Share Posted June 8, 2011 Javascript konsole kljuudas nemet? (paarbaudiit var ar Inspector uz Webkit paarluukiem vai Firebug uz Firefox) Link to comment Share on other sites More sharing options...
reGative Posted June 8, 2011 Author Report Share Posted June 8, 2011 Tikko pārbaudīju firebug uz firefox. rāda, ka nav tāda 'request'. Ko varētu lietot 'request' vietā? Link to comment Share on other sites More sharing options...
rATRIJS Posted June 8, 2011 Report Share Posted June 8, 2011 Varētu sākt ar koda izprašanu un izlasīšanu visu to kas bija rakstīts no kurienes tu to kodu rāvi. Lieto jQuery Link to comment Share on other sites More sharing options...
daGrevis Posted June 9, 2011 Report Share Posted June 9, 2011 Topika turpinājums, kas vairāk ar JScript'u un jQuery saistīts: http://php.lv/f/topic/19054-jquery-un-mana-funkcija/page__pid__148107 . Link to comment Share on other sites More sharing options...
Recommended Posts