I’m creating a site for myself and some fellow musicians to play and share some our tunes with the world…🆒 Once the home page has loaded, I’d rather it stay loaded, (music playing, iframes loaded, large database retrieved, etc.).
This function populates an iframe with a new and unique link for each of the artists’ (that’s where I need some help). The function call 'load_artists_frame($cdb)',
kicks it all off…
<?php
function load_artists_frame($cdb) { ?><script type="text/javascript">
AList_frame.document.designMode="on";
AList_frame.document.open();
AList_frame.document.write('<head><link href="head/CDB_text.css" rel="stylesheet" type="text/css"><style type="text/css">body{background-color: #14285f;}</style></head><?php
for ($i = 0; $i <= count($cdb); $i++) {
if ($cdb[$i]['artist_name'] != '') { $profile = $i;
$profile_link = '<a href="<<<<<<<<<< need help in here >>>>>>>>>>">'.$i.' '.$cdb[$i]['artist_name'].'</a><br>';
echo $profile_link; } } ?>');
AList_frame.document.close();
AList_frame.document.designMode="off";
AList_frame.focus();
</SCRIPT><?php }
<iframe id="AList_frame" style="width:150px; height:400px;"></iframe>
This next function populates another iframe with a unique link for each of the artist’s tunes available for a forced downloading popup. This function requires $profile (artist’s id number) from the function above function.
<?php
function load_songlist_frame($profile, $cdb, $cdsl) {
$ftp = $cdb[$profile]['ftp']; ?>
<script type="text/javascript">
SList_frame.document.designMode="on";
SList_frame.document.open();
SList_frame.document.write('<head><link href="head/CDB_text.css" rel="stylesheet" type="text/css"><style type="text/css">body{background-color: #14285f;}</style></head><div align="left" class="sidebarHeader_smaller">Presenting...<?php echo $cdb[$profile]['artist_name']; ?><br /><br /></div><?php
for ($i = 1; $i <= 6; $i++) {$cd=$cdsl[$profile]['CD'.$i.'_title'];
if (strpos($cd, 'Coming Soon') !=4 and $cd != '') { ?><div class="smallText_Red"><strong><?php echo $cd; ?><br /></strong></div><div class="smallerText"><strong><em><?php }
for ($t = 1; $t <= 12; $t++) {$track=$cdsl[$profile]['CD'.$i.'_tr'.$t];
if ($track != '') {$filename = $ftp.rawurlencode($track);
$file_extension=strtolower(substr(strrchr($filename,"."),1));
if ($file_extension != "mp3" and $file_extension != "Mp3" and $file_extension != "MP3") {$filename = $filename.".mp3";}
$new_link = '<a href=code/CDB_download_process.php?'.$filename.' class="smallerText">'.$track.'</a>';
echo $new_link; ?><br /></em></strong></div><?php } } } ?>');
SList_frame.document.close();
SList_frame.document.designMode="off";
SList_frame.focus();
</SCRIPT><?php }
load_songlist_frame($profile, $cdb, $cdsl)
<iframe id="SList_frame" style="width:150px; height:400px;"></iframe>
In my perfect world,
<?php <a href="javascript:"onclick="<? $profile='.$i.'; load_songlist_frame($profile, $cdb, $cdsl) ?>"> '.$i.' '.$cdb[$i]['artist_name'].'</a><br>'; ?>
would do the trick, but I swear, my computer chuckled at me when I said, ‘Just do it’! Maybe we can call another small function to make it work… I don’t really want to load another URL with a query. (Viewers downloading multiple tunes simultaneously, player streaming music to play, iframes updating banners, all makes the url method really slow).
The link below works, and dose that I need in java, if we can get it to call the php function (load_songlist_frame($profile, $cdb, $cdsl)), and pass the $profile instead of profile, I would be at piece with the world once more. ($cdb, $cdsl are both arrays previously loaded from mysql tables). There must be a workaround to accomplish the same thing? Can a java function call the php function? Or can the link be adjusted to call the php link. Or can my function be changed to all java but use my php arrays? It boggles my mind.
<?php
$i = 5;
$test = '<a href="javascript:"onclick="profile='.$i.'; test_java()">'.$i.' '.$cdb[$i]['artist_name'].'</a>';
echo $test;
?>
<script type="text/javascript">
function test_java() { alert('Test function: has been successfully called: profile = ' + profile) }
</ script >
Please excuse my poor coding form and technique, but 3 weeks ago I thought mysql was a medical condition. I’m learning just as fast as I can, but now feel a little overwhelmed.